WebResourceError class

Error returned in WebView.onWebResourceError when a web resource loading error has occurred.

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

{@tool sample} This example demonstrates how to extend the WebResourceError to provide additional platform specific parameters.

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

class IOSWebResourceError extends WebResourceError {
  IOSWebResourceError._(WebResourceError error, {required this.domain})
      : super(
          errorCode: error.errorCode,
          description: error.description,
          errorType: error.errorType,
        );

  factory IOSWebResourceError.fromWebResourceError(
    WebResourceError error, {
    required String? domain,
  }) {
    return IOSWebResourceError._(error, domain: domain);
  }

  final String? domain;
}

{@end-tool}

Annotations

Constructors

WebResourceError({required int errorCode, required String description, WebResourceErrorType? errorType, bool? isForMainFrame, String? url})
Used by the platform implementation to create a new WebResourceError.
const

Properties

description String
Description of the error that can be used to communicate the problem to the user.
final
errorCode int
Raw code of the error from the respective platform.
final
errorType WebResourceErrorType?
The type this error can be categorized as.
final
hashCode int
The hash code for this object.
no setterinherited
isForMainFrame bool?
Whether the error originated from the main frame.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
url String?
The URL for which the failing resource request was made.
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