loadSimulatedRequest method
- required URLRequest urlRequest,
- required Uint8List data,
- URLResponse? urlResponse,
Loads the web content from the data you provide as if the data were the response to the request.
If urlResponse is null, it loads the web content from the data as an utf8 encoded HTML string as the response to the request.
urlRequest represents a URL request that specifies the base URL and other loading details the system uses to interpret the data you provide.
urlResponse represents a response the system uses to interpret the data you provide.
data represents the data or the utf8 encoded HTML string to use as the contents of the webpage.
Example:
controller.loadSimulatedRequest(urlRequest: URLRequest(
url: WebUri("https://flutter.dev"),
),
data: Uint8List.fromList(utf8.encode("<h1>Hello</h1>"))
);
Officially Supported Platforms/Implementations:
- iOS WKWebView 15.0+ (Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)):
- macOS WKWebView 12.0+ (Official API - WKWebView.loadSimulatedRequest(_:response:responseData:)):
Parameters - Officially Supported Platforms/Implementations:
urlRequest: all platformsdata: all platformsurlResponse: all platforms
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
Future<void> loadSimulatedRequest({
required URLRequest urlRequest,
required Uint8List data,
URLResponse? urlResponse,
}) => platform.loadSimulatedRequest(urlRequest: urlRequest, data: data);