loadUrl method Null safety

Future<void> loadUrl(
  1. {required URLRequest urlRequest,
  2. @Deprecated('Use `allowingReadAccessTo` instead') Uri? iosAllowingReadAccessTo,
  3. Uri? allowingReadAccessTo}

Loads the given urlRequest.

  • allowingReadAccessTo, used in combination with urlRequest (using the file:// scheme), it represents the URL from which to read the web content. This URL must be a file-based URL (using the file:// scheme). Specify the same value as the URL parameter to prevent WebView from reading any other content. Specify a directory to give WebView permission to read additional files in the specified directory. NOTE: available only on iOS.

NOTE for Android: when loading an URL Request using "POST" method, headers are ignored.

Supported Platforms/Implementations:


Future<void> loadUrl(
    {required URLRequest urlRequest,
    @Deprecated('Use `allowingReadAccessTo` instead')
        Uri? iosAllowingReadAccessTo,
    Uri? allowingReadAccessTo}) async {
  assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty);
  assert(iosAllowingReadAccessTo == null ||

  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('urlRequest', () => urlRequest.toMap());
      () =>
          allowingReadAccessTo?.toString() ??
  await _channel.invokeMethod('loadUrl', args);