setJavaScriptBridgeName method

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(), MacOSPlatform(), WebPlatform(), WindowsPlatform(), LinuxPlatform()])
Future<void> setJavaScriptBridgeName(
  1. String bridgeName
)

Sets the name of the JavaScript Bridge object that will be used to interact with the WebView. This method should be called before any WebViews are created or when there are no WebViews. Calling this method after a WebView has been created will not change the current JavaScript Bridge object and could lead to errors.

The bridgeName must be a non-empty string with only alphanumeric and underscore characters. It can't start with a number.

The default name used by this plugin is flutter_inappwebview_forge.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • macOS WKWebView
  • Web <iframe> but requires same origin
  • Windows WebView2
  • Linux WPE WebKit

Parameters - Officially Supported Platforms/Implementations:

  • bridgeName: all platforms

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

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(),
    IOSPlatform(),
    MacOSPlatform(),
    WebPlatform(),
    WindowsPlatform(),
    LinuxPlatform(),
  ],
)
Future<void> setJavaScriptBridgeName(String bridgeName) {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.setJavaScriptBridgeName.name} is not implemented on the current platform',
  );
}