isSecureContext method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(available: '21', note: 'This method is implemented using JavaScript.'), IOSPlatform(note: 'This method is implemented using JavaScript.'), LinuxPlatform(note: 'This method is implemented using JavaScript.'), MacOSPlatform(note: 'This method is implemented using JavaScript.'), WebPlatform(apiName: 'Window.isSecureContext', apiUrl: 'https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext'), WindowsPlatform(note: 'This method is implemented using JavaScript.')])
Future<bool> isSecureContext()

Indicates whether the webpage context is capable of using features that require secure contexts.

Officially Supported Platforms/Implementations:

  • Android WebView 21+:
    • This method is implemented using JavaScript.
  • iOS WKWebView:
    • This method is implemented using JavaScript.
  • Linux WPE WebKit:
    • This method is implemented using JavaScript.
  • macOS WKWebView:
    • This method is implemented using JavaScript.
  • Web <iframe> but requires same origin (Official API - Window.isSecureContext)
  • Windows WebView2:
    • This method is implemented using JavaScript.

Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      available: '21',
      note: 'This method is implemented using JavaScript.',
    ),
    IOSPlatform(note: 'This method is implemented using JavaScript.'),
    LinuxPlatform(note: 'This method is implemented using JavaScript.'),
    MacOSPlatform(note: 'This method is implemented using JavaScript.'),
    WebPlatform(
      apiName: 'Window.isSecureContext',
      apiUrl:
          'https://developer.mozilla.org/en-US/docs/Web/API/Window/isSecureContext',
    ),
    WindowsPlatform(note: 'This method is implemented using JavaScript.'),
  ],
)
Future<bool> isSecureContext() {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.isSecureContext.name} is not implemented on the current platform',
  );
}