NavigationDelegate class

Callbacks for accepting or rejecting navigation changes, and for tracking the progress of navigation requests.

See WebViewController.setNavigationDelegate.

Platform-Specific Features

This class contains an underlying implementation provided by the current platform. Once a platform implementation is imported, the examples below can be followed to use features provided by a platform's implementation.

Below is an example of setting platform-specific creation parameters for iOS and Android:

PlatformNavigationDelegateCreationParams params =
    const PlatformNavigationDelegateCreationParams();

if (WebViewPlatform.instance is WebKitWebViewPlatform) {
  params = WebKitNavigationDelegateCreationParams
      .fromPlatformNavigationDelegateCreationParams(
    params,
  );
} else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
  params = AndroidNavigationDelegateCreationParams
      .fromPlatformNavigationDelegateCreationParams(
    params,
  );
}

final NavigationDelegate navigationDelegate =
    NavigationDelegate.fromPlatformCreationParams(
  params,
);

Below is an example of accessing the platform-specific implementation for iOS and Android:

final NavigationDelegate navigationDelegate = NavigationDelegate();

if (WebViewPlatform.instance is WebKitWebViewPlatform) {
  final WebKitNavigationDelegate webKitDelegate =
      navigationDelegate.platform as WebKitNavigationDelegate;
} else if (WebViewPlatform.instance is AndroidWebViewPlatform) {
  final AndroidNavigationDelegate androidDelegate =
      navigationDelegate.platform as AndroidNavigationDelegate;
}

Constructors

Constructs a NavigationDelegate.
Constructs a NavigationDelegate from a specific platform implementation.
Constructs a NavigationDelegate from creation params for a specific platform.

Properties

hashCode int
The hash code for this object.
no setterinherited
onNavigationRequest → NavigationRequestCallback?
Invoked when a decision for a navigation request is pending.
final
onPageFinished → PageEventCallback?
Invoked when a page has finished loading.
final
onPageStarted → PageEventCallback?
Invoked when a page has started loading.
final
onProgress → ProgressCallback?
Invoked when a page is loading to report the progress.
final
onWebResourceError → WebResourceErrorCallback?
Invoked when a resource loading error occurred.
final
platform → PlatformNavigationDelegate
Implementation of PlatformNavigationDelegate for the current platform.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited