loadRequest method

Future<void> loadRequest(
  1. Uri uri, {
  2. LoadRequestMethod method = LoadRequestMethod.get,
  3. Map<String, String> headers = const <String, String>{},
  4. Uint8List? body,
})

Makes a specific HTTP request ands loads the response in the webview.

method must be one of the supported HTTP methods in LoadRequestMethod.

If headers is not empty, its key-value pairs will be added as the headers for the request.

If body is not null, it will be added as the body for the request.

Throws an ArgumentError if uri has an empty scheme.

Implementation

Future<void> loadRequest(
  Uri uri, {
  LoadRequestMethod method = LoadRequestMethod.get,
  Map<String, String> headers = const <String, String>{},
  Uint8List? body,
}) {
  if (uri.scheme.isEmpty) {
    throw ArgumentError('Missing scheme in uri: $uri');
  }
  return platform.loadRequest(LoadRequestParams(
    uri: uri,
    method: method,
    headers: headers,
    body: body,
  ));
}