WebResourceResponse class

Contains information about the response for a request.

Platform specific implementations can add additional fields by extending this class.

This example demonstrates how to extend the WebResourceResponse to provide additional platform specific parameters.

When extending WebResourceResponse additional parameters should always accept null or have a default value to prevent breaking changes.

class AndroidWebResourceResponse extends WebResourceResponse {
  WebResourceResponse._({
    required WebResourceResponse response,
  }) : super(
    uri: response.uri,
    statusCode: response.statusCode,
    headers: response.headers,
  );

  factory AndroidWebResourceResponse.fromWebResourceResponse(
    WebResourceResponse response, {
    Uri? historyUrl,
  }) {
    return AndroidWebResourceResponse._(response, historyUrl: historyUrl);
  }

  final Uri? historyUrl;
}
Annotations

Constructors

WebResourceResponse({required Uri? uri, required int statusCode, Map<String, String> headers = const <String, String>{}})
Used by the platform implementation to create a new WebResourceResponse.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Headers for the request.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
The HTTP status code.
final
uri Uri?
The URI that this response is associated with.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited