NavigationDelegate.fromPlatform constructor

NavigationDelegate.fromPlatform(
  1. PlatformNavigationDelegate platform, {
  2. NavigationRequestCallback? onNavigationRequest,
  3. PageEventCallback? onPageStarted,
  4. PageEventCallback? onPageFinished,
  5. ProgressCallback? onProgress,
  6. WebResourceErrorCallback? onWebResourceError,
  7. void onUrlChange(
    1. UrlChange change
    )?,
  8. HttpAuthRequestCallback? onHttpAuthRequest,
  9. void onHttpError(
    1. HttpResponseError error
    )?,
})

Constructs a NavigationDelegate from a specific platform implementation.

onUrlChange: invoked when the underlying web view changes to a new url. onHttpAuthRequest: invoked when the web view is requesting authentication.

Implementation

NavigationDelegate.fromPlatform(
  this.platform, {
  this.onNavigationRequest,
  this.onPageStarted,
  this.onPageFinished,
  this.onProgress,
  this.onWebResourceError,
  void Function(UrlChange change)? onUrlChange,
  HttpAuthRequestCallback? onHttpAuthRequest,
  void Function(HttpResponseError error)? onHttpError,
}) {
  if (onNavigationRequest != null) {
    platform.setOnNavigationRequest(onNavigationRequest!);
  }
  if (onPageStarted != null) {
    platform.setOnPageStarted(onPageStarted!);
  }
  if (onPageFinished != null) {
    platform.setOnPageFinished(onPageFinished!);
  }
  if (onProgress != null) {
    platform.setOnProgress(onProgress!);
  }
  if (onWebResourceError != null) {
    platform.setOnWebResourceError(onWebResourceError!);
  }
  if (onUrlChange != null) {
    platform.setOnUrlChange(onUrlChange);
  }
  if (onHttpAuthRequest != null) {
    platform.setOnHttpAuthRequest(onHttpAuthRequest);
  }
  if (onHttpError != null) {
    platform.setOnHttpError(onHttpError);
  }
}