loadUrl method
- required URLRequest urlRequest,
- @Deprecated('Use allowingReadAccessTo instead') Uri? iosAllowingReadAccessTo,
- WebUri? allowingReadAccessTo,
Loads the given urlRequest.
allowingReadAccessTo, used in combination withurlRequest(using thefile://scheme), it represents the URL from which to read the web content. This URL must be a file-based URL (using thefile://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.
Officially Supported Platforms/Implementations:
- Android WebView (Official API - WebView.loadUrl):
- If method is "POST", Official API - WebView.postUrl. Also, when loading an URL Request using "POST" method, headers are ignored.
- iOS WKWebView (Official API - WKWebView.load):
- If
allowingReadAccessTois used, Official API - WKWebView.loadFileURL
- If
- macOS WKWebView (Official API - WKWebView.load):
- If
allowingReadAccessTois used, Official API - WKWebView.loadFileURL
- If
- Web <iframe> but requires same origin:
- If method is "GET" and headers are empty, it will change the
srcof the iframe. For all other cases it will try to create an XMLHttpRequest and load the result inside the iframe.
- If method is "GET" and headers are empty, it will change the
- Windows WebView2 (Official API - ICoreWebView2_2.NavigateWithWebResourceRequest)
- Linux WPE WebKit (Official API - webkit_web_view_load_uri)
Parameters - Officially Supported Platforms/Implementations:
urlRequest: all platformsallowingReadAccessTo:- iOS WKWebView
- macOS WKWebView
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
Future<void> loadUrl({
required URLRequest urlRequest,
@Deprecated('Use allowingReadAccessTo instead')
Uri? iosAllowingReadAccessTo,
WebUri? allowingReadAccessTo,
}) => platform.loadUrl(
urlRequest: urlRequest,
iosAllowingReadAccessTo: iosAllowingReadAccessTo,
allowingReadAccessTo: allowingReadAccessTo,
);