navigate method

  1. @SupportedPlatforms(platforms: [AndroidPlatform(apiName: 'WebViewCompat.navigate', apiUrl: 'https://developer.android.com/reference/androidx/webkit/WebViewCompat#navigate(android.webkit.WebView,java.lang.String,androidx.webkit.NavigationParameters)', note: 'Requires [WebViewFeature.NAVIGATION_LISTENER]. Falls back to loadUrl otherwise.')])
Future<void> navigate({
  1. required WebUri url,
  2. bool replaceHistory = false,
  3. Map<String, String>? headers,
})

Loads url with optional history replacement and extra headers.

This is the AndroidX WebViewCompat.navigate API. When the feature is unavailable the call falls back to loadUrl.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • url: all platforms
  • replaceHistory: all platforms
  • headers: all platforms

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

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebViewCompat.navigate',
      apiUrl:
          'https://developer.android.com/reference/androidx/webkit/WebViewCompat#navigate(android.webkit.WebView,java.lang.String,androidx.webkit.NavigationParameters)',
      note:
          'Requires [WebViewFeature.NAVIGATION_LISTENER]. Falls back to loadUrl otherwise.',
    ),
  ],
)
Future<void> navigate({
  required WebUri url,
  bool replaceHistory = false,
  Map<String, String>? headers,
}) {
  throw UnimplementedError(
    '${PlatformInAppWebViewControllerMethod.navigate.name} is not implemented on the current platform',
  );
}