loadSimulatedRequest method

Future<void> loadSimulatedRequest({
  1. required URLRequest urlRequest,
  2. required Uint8List data,
  3. 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.loadSimulateloadSimulatedRequestdRequest(urlRequest: URLRequest(
   url: WebUri("https://flutter.dev"),
 ),
 data: Uint8List.fromList(utf8.encode("<h1>Hello</h1>"))
);

NOTE for iOS: available on iOS 15.0+.

NOTE for MacOS: available on MacOS 12.0+.

Officially Supported Platforms/Implementations:

Implementation

Future<void> loadSimulatedRequest(
        {required URLRequest urlRequest,
        required Uint8List data,
        URLResponse? urlResponse}) =>
    platform.loadSimulatedRequest(urlRequest: urlRequest, data: data);