updated enum types ssl_error_type, permission_resource_type and web_resource_error_type

This commit is contained in:
Lorenzo Pichilli 2022-05-01 23:51:29 +02:00
parent b189066940
commit fef47e7930
8 changed files with 483 additions and 396 deletions

View File

@ -17,12 +17,7 @@ void onPermissionRequest() {
].contains(defaultTargetPlatform);
var expectedValue = [];
if (defaultTargetPlatform == TargetPlatform.android) {
expectedValue = [PermissionResourceType.RESOURCE_VIDEO_CAPTURE];
} else if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
expectedValue = [PermissionResourceType.CAMERA];
}
expectedValue = [PermissionResourceType.CAMERA];
testWidgets('onPermissionRequest', (WidgetTester tester) async {
final Completer controllerCompleter = Completer<InAppWebViewController>();

View File

@ -163,7 +163,7 @@ class InAppWebViewController {
_webview!.onReceivedError!(this, request, error);
else if (isForMainFrame) {
// ignore: deprecated_member_use_from_same_package
_webview!.onLoadError!(this, request.url, error.type.toIntValue(),
_webview!.onLoadError!(this, request.url, error.type.toNativeValue(),
error.description);
}
} else {
@ -171,7 +171,7 @@ class InAppWebViewController {
_inAppBrowser!
// ignore: deprecated_member_use_from_same_package
.onLoadError(
request.url, error.type.toIntValue(), error.description);
request.url, error.type.toNativeValue(), error.description);
}
_inAppBrowser!.onReceivedError(request, error);
}

View File

@ -29,7 +29,7 @@ class PermissionRequest {
List<PermissionResourceType> resources = [];
if (map["resources"] != null) {
(map["resources"].cast<dynamic>() as List<dynamic>).forEach((element) {
var resource = PermissionResourceType.fromValue(element);
var resource = PermissionResourceType.fromNativeValue(element);
if (resource != null) {
resources.add(resource);
}

View File

@ -2,50 +2,27 @@ import 'package:flutter/foundation.dart';
///Class that represents a type of resource used to ask user's permission.
class PermissionResourceType {
final dynamic _value;
final String _value;
final dynamic _nativeValue;
const PermissionResourceType._internal(this._value);
const PermissionResourceType._internal(this._value, this._nativeValue);
///Set of all values of [PermissionResourceType].
static final Set<PermissionResourceType> values = [
PermissionResourceType.RESOURCE_AUDIO_CAPTURE,
PermissionResourceType.RESOURCE_MIDI_SYSEX,
PermissionResourceType.RESOURCE_PROTECTED_MEDIA_ID,
PermissionResourceType.RESOURCE_VIDEO_CAPTURE,
PermissionResourceType.MIDI_SYSEX,
PermissionResourceType.PROTECTED_MEDIA_ID,
PermissionResourceType.CAMERA,
PermissionResourceType.MICROPHONE,
PermissionResourceType.CAMERA_AND_MICROPHONE,
PermissionResourceType.DEVICE_ORIENTATION_AND_MOTION,
].toSet();
static final Set<PermissionResourceType> _androidValues = [
PermissionResourceType.RESOURCE_AUDIO_CAPTURE,
PermissionResourceType.RESOURCE_MIDI_SYSEX,
PermissionResourceType.RESOURCE_PROTECTED_MEDIA_ID,
PermissionResourceType.RESOURCE_VIDEO_CAPTURE,
].toSet();
static final Set<PermissionResourceType> _appleValues =
<PermissionResourceType>[
PermissionResourceType.CAMERA,
PermissionResourceType.MICROPHONE,
PermissionResourceType.CAMERA_AND_MICROPHONE,
PermissionResourceType.DEVICE_ORIENTATION_AND_MOTION,
].toSet();
///Gets a possible [PermissionResourceType] instance from a value.
static PermissionResourceType? fromValue(dynamic value) {
///Gets a possible [PermissionResourceType] instance from a [String] value.
static PermissionResourceType? fromValue(String? value) {
if (value != null) {
try {
Set<PermissionResourceType> valueList =
<PermissionResourceType>[].toSet();
if (defaultTargetPlatform == TargetPlatform.android) {
valueList = PermissionResourceType._androidValues;
} else if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
valueList = PermissionResourceType._appleValues;
}
return valueList.firstWhere((element) => element.toValue() == value);
return PermissionResourceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
@ -53,77 +30,102 @@ class PermissionResourceType {
return null;
}
///Gets the value.
dynamic toValue() => _value;
///Gets a possible [PermissionResourceType] instance from a value.
static PermissionResourceType? fromNativeValue(dynamic value) {
if (value != null) {
try {
return PermissionResourceType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets native value.
dynamic toNativeValue() => _nativeValue;
@override
String toString() {
if (_value is String) {
return _value;
}
switch (_value) {
case 0:
return "CAMERA";
case 1:
return "MICROPHONE";
case 2:
return "CAMERA_AND_MICROPHONE";
default:
return "";
}
}
String toString() => _value;
///Resource belongs to audio capture device, like microphone.
///
///**NOTE**: available only on Android.
static const RESOURCE_AUDIO_CAPTURE = const PermissionResourceType._internal(
'android.webkit.resource.AUDIO_CAPTURE');
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE))
///- iOS ([Official API - WKMediaCaptureType.microphone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone))
static final MICROPHONE = PermissionResourceType._internal(
'MICROPHONE',
(defaultTargetPlatform != TargetPlatform.android)
? 'android.webkit.resource.AUDIO_CAPTURE'
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 1
: null));
///Resource will allow sysex messages to be sent to or received from MIDI devices.
///These messages are privileged operations, e.g. modifying sound libraries and sampling data, or even updating the MIDI device's firmware.
///Permission may be requested for this resource in API levels 21 and above, if the Android device has been updated to WebView 45 or above.
///
///**NOTE**: available only on Android.
static const RESOURCE_MIDI_SYSEX = const PermissionResourceType._internal(
'android.webkit.resource.MIDI_SYSEX');
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_MIDI_SYSEX](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_MIDI_SYSEX))
static final MIDI_SYSEX = PermissionResourceType._internal(
'MIDI_SYSEX',
(defaultTargetPlatform != TargetPlatform.android)
? 'android.webkit.resource.MIDI_SYSEX'
: null);
///Resource belongs to protected media identifier. After the user grants this resource, the origin can use EME APIs to generate the license requests.
///
///**NOTE**: available only on Android.
static const RESOURCE_PROTECTED_MEDIA_ID =
const PermissionResourceType._internal(
'android.webkit.resource.PROTECTED_MEDIA_ID');
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_PROTECTED_MEDIA_ID))
static final PROTECTED_MEDIA_ID = PermissionResourceType._internal(
'PROTECTED_MEDIA_ID',
(defaultTargetPlatform != TargetPlatform.android)
? 'android.webkit.resource.PROTECTED_MEDIA_ID'
: null);
///Resource belongs to video capture device, like camera.
///
///**NOTE**: available only on Android.
static const RESOURCE_VIDEO_CAPTURE = const PermissionResourceType._internal(
'android.webkit.resource.VIDEO_CAPTURE');
///A media device that can capture video.
///
///**NOTE**: available only on iOS.
static const CAMERA = const PermissionResourceType._internal(0);
///A media device that can capture audio.
///
///**NOTE**: available only on iOS.
static const MICROPHONE = const PermissionResourceType._internal(1);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - PermissionRequest.RESOURCE_VIDEO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_VIDEO_CAPTURE))
///- iOS ([Official API - WKMediaCaptureType.camera](https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera))
static final CAMERA = PermissionResourceType._internal(
'CAMERA',
(defaultTargetPlatform != TargetPlatform.android)
? 'android.webkit.resource.VIDEO_CAPTURE'
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 0
: null));
///A media device or devices that can capture audio and video.
///
///**NOTE**: available only on iOS.
static const CAMERA_AND_MICROPHONE =
const PermissionResourceType._internal(2);
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKMediaCaptureType.cameraAndMicrophone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone))
static final CAMERA_AND_MICROPHONE = PermissionResourceType._internal(
'CAMERA_AND_MICROPHONE',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 2
: null);
///Resource belongs to the devices orientation and motion.
///
///**NOTE**: available only on iOS.
static const DEVICE_ORIENTATION_AND_MOTION =
const PermissionResourceType._internal('deviceOrientationAndMotion');
///**Supported Platforms/Implementations**:
///- iOS
static final DEVICE_ORIENTATION_AND_MOTION = PermissionResourceType._internal(
'DEVICE_ORIENTATION_AND_MOTION',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 'deviceOrientationAndMotion'
: null);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}
}

View File

@ -24,7 +24,7 @@ class SslError {
this.message}) {
this.code = this.code ??
// ignore: deprecated_member_use_from_same_package
SslErrorType.fromValue(this.androidError?.toValue() ??
SslErrorType.fromNativeValue(this.androidError?.toValue() ??
// ignore: deprecated_member_use_from_same_package
this.iosError?.toValue());
}
@ -39,7 +39,7 @@ class SslError {
androidError: AndroidSslError.fromValue(map["code"]),
// ignore: deprecated_member_use_from_same_package
iosError: IOSSslError.fromValue(map["code"]),
code: SslErrorType.fromValue(map["code"]),
code: SslErrorType.fromNativeValue(map["code"]),
message: map["message"]);
}

View File

@ -5,18 +5,18 @@ import 'server_trust_challenge.dart';
///Class that represents the SSL Primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class.
class SslErrorType {
final int _value;
final String _value;
final int _nativeValue;
const SslErrorType._internal(this._value);
const SslErrorType._internal(this._value, this._nativeValue);
///Set of all values of [SslErrorType].
static final Set<SslErrorType> values = [
SslErrorType.SSL_NOTYETVALID,
SslErrorType.SSL_EXPIRED,
SslErrorType.SSL_IDMISMATCH,
SslErrorType.SSL_UNTRUSTED,
SslErrorType.SSL_DATE_INVALID,
SslErrorType.SSL_INVALID,
SslErrorType.NOT_YET_VALID,
SslErrorType.EXPIRED,
SslErrorType.IDMISMATCH,
SslErrorType.UNTRUSTED,
SslErrorType.DATE_INVALID,
SslErrorType.INVALID,
SslErrorType.DENY,
SslErrorType.UNSPECIFIED,
@ -25,36 +25,12 @@ class SslErrorType {
SslErrorType.OTHER_ERROR,
].toSet();
static final Set<SslErrorType> _androidValues = [
SslErrorType.SSL_NOTYETVALID,
SslErrorType.SSL_EXPIRED,
SslErrorType.SSL_IDMISMATCH,
SslErrorType.SSL_UNTRUSTED,
SslErrorType.SSL_DATE_INVALID,
SslErrorType.SSL_INVALID,
].toSet();
static final Set<SslErrorType> _appleValues = [
SslErrorType.INVALID,
SslErrorType.DENY,
SslErrorType.UNSPECIFIED,
SslErrorType.RECOVERABLE_TRUST_FAILURE,
SslErrorType.FATAL_TRUST_FAILURE,
SslErrorType.OTHER_ERROR,
].toSet();
///Gets a possible [SslErrorType] instance from an [int] value.
static SslErrorType? fromValue(int? value) {
///Gets a possible [SslErrorType] instance from a [String] value.
static SslErrorType? fromValue(String? value) {
if (value != null) {
try {
Set<SslErrorType> valueList = <SslErrorType>[].toSet();
if (defaultTargetPlatform == TargetPlatform.android) {
valueList = SslErrorType._androidValues;
} else if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
valueList = SslErrorType._appleValues;
}
return valueList.firstWhere((element) => element.toValue() == value);
return SslErrorType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
@ -62,107 +38,159 @@ class SslErrorType {
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
if (defaultTargetPlatform == TargetPlatform.android) {
switch (_value) {
case 1:
return "SSL_EXPIRED";
case 2:
return "SSL_IDMISMATCH";
case 3:
return "SSL_UNTRUSTED";
case 4:
return "SSL_DATE_INVALID";
case 5:
return "SSL_INVALID";
case 0:
default:
return "SSL_NOTYETVALID";
}
} else if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
switch (_value) {
case 3:
return "DENY";
case 4:
return "UNSPECIFIED";
case 5:
return "RECOVERABLE_TRUST_FAILURE";
case 6:
return "FATAL_TRUST_FAILURE";
case 7:
return "OTHER_ERROR";
case 0:
default:
return "INVALID";
///Gets a possible [SslErrorType] instance from a value.
static SslErrorType? fromNativeValue(int? value) {
if (value != null) {
try {
return SslErrorType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return "";
return null;
}
///The certificate is not yet valid
///
///**NOTE**: available only on Android
static const SSL_NOTYETVALID = const SslErrorType._internal(0);
///Gets [String] value.
String toValue() => _value;
///The certificate has expired
///
///**NOTE**: available only on Android
static const SSL_EXPIRED = const SslErrorType._internal(1);
///Gets native [int] value.
int toNativeValue() => _nativeValue;
///Hostname mismatch
///
///**NOTE**: available only on Android
static const SSL_IDMISMATCH = const SslErrorType._internal(2);
@override
String toString() => _value;
///The certificate authority is not trusted
///The certificate is not yet valid.
///
///**NOTE**: available only on Android
static const SSL_UNTRUSTED = const SslErrorType._internal(3);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_NOTYETVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_NOTYETVALID))
static final NOT_YET_VALID = SslErrorType._internal('NOT_YET_VALID',
(defaultTargetPlatform != TargetPlatform.android) ? 0 : -1);
///The date of the certificate is invalid
///The certificate has expired.
///
///**NOTE**: available only on Android
static const SSL_DATE_INVALID = const SslErrorType._internal(4);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_EXPIRED](https://developer.android.com/reference/android/net/http/SslError#SSL_EXPIRED))
static final EXPIRED = SslErrorType._internal(
'EXPIRED', (defaultTargetPlatform != TargetPlatform.android) ? 1 : -1);
///A generic error occurred
///Hostname mismatch.
///
///**NOTE**: available only on Android
static const SSL_INVALID = const SslErrorType._internal(5);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_IDMISMATCH](https://developer.android.com/reference/android/net/http/SslError#SSL_IDMISMATCH))
static final IDMISMATCH = SslErrorType._internal(
'IDMISMATCH', (defaultTargetPlatform != TargetPlatform.android) ? 2 : -1);
///Indicates an invalid setting or result.
///The certificate authority is not trusted.
///
///**NOTE**: available only on iOS
static const INVALID = const SslErrorType._internal(0);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_UNTRUSTED](https://developer.android.com/reference/android/net/http/SslError#SSL_UNTRUSTED))
static final UNTRUSTED = SslErrorType._internal(
'UNTRUSTED', (defaultTargetPlatform != TargetPlatform.android) ? 3 : -1);
///Indicates a user-configured deny; do not proceed.
///The date of the certificate is invalid.
///
///**NOTE**: available only on iOS
static const DENY = const SslErrorType._internal(3);
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_DATE_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_DATE_INVALID))
static final DATE_INVALID = SslErrorType._internal('DATE_INVALID',
(defaultTargetPlatform != TargetPlatform.android) ? 4 : -1);
///Indicates an invalid setting or result. A generic error occurred.
///
///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - SslError.SSL_INVALID](https://developer.android.com/reference/android/net/http/SslError#SSL_INVALID))
///- iOS ([Official API - SecTrustResultType.invalid](https://developer.apple.com/documentation/security/sectrustresulttype/invalid))
static final INVALID = SslErrorType._internal(
'INVALID',
(defaultTargetPlatform != TargetPlatform.android)
? 5
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 0
: -1));
///The user specified that the certificate should not be trusted.
///
///This value indicates that the user explicitly chose to not trust a certificate in the chain,
///usually by clicking the appropriate button in a certificate trust panel.
///Your app should not trust the chain.
///The Keychain Access utility refers to this value as "Never Trust."
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.deny](https://developer.apple.com/documentation/security/sectrustresulttype/deny))
static final DENY = SslErrorType._internal(
'DENY',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 3
: -1);
///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
///
///**NOTE**: available only on iOS
static const UNSPECIFIED = const SslErrorType._internal(4);
///Indicates a trust policy failure which can be overridden by the user.
///This value indicates that evaluation reached an (implicitly trusted) anchor certificate without any evaluation failures,
///but never encountered any explicitly stated user-trust preference.
///This is the most common return value.
///The Keychain Access utility refers to this value as the Use System Policy, which is the default user setting.
///
///**NOTE**: available only on iOS
static const RECOVERABLE_TRUST_FAILURE = const SslErrorType._internal(5);
///Indicates a trust failure which cannot be overridden by the user.
///When receiving this value, most apps should trust the chain.
///
///**NOTE**: available only on iOS
static const FATAL_TRUST_FAILURE = const SslErrorType._internal(6);
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.unspecified](https://developer.apple.com/documentation/security/sectrustresulttype/unspecified))
static final UNSPECIFIED = SslErrorType._internal(
'UNSPECIFIED',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 4
: -1);
///Trust is denied, but recovery may be possible.
///
///This value indicates that you should not trust the chain as is,
///but that the chain could be trusted with some minor change to the evaluation context,
///such as ignoring expired certificates or adding another anchor to the set of trusted anchors.
///
///The way you handle this depends on the situation.
///For example, if you are performing signature validation and you know when the message was originally received,
///you should check again using that date to see if the message was valid when you originally received it.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.recoverableTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/recoverabletrustfailure))
static final RECOVERABLE_TRUST_FAILURE = SslErrorType._internal(
'RECOVERABLE_TRUST_FAILURE',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 5
: -1);
///Trust is denied and no simple fix is available.
///
///This value indicates that evaluation failed because a certificate in the chain is defective.
///This usually represents a fundamental defect in the certificate data, such as an invalid encoding for a critical subjectAltName extension,
///an unsupported critical extension, or some other critical portion of the certificate that couldnt be interpreted.
///Changing parameter values and reevaluating is unlikely to succeed unless you provide different certificates.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.fatalTrustFailure](https://developer.apple.com/documentation/security/sectrustresulttype/fataltrustfailure))
static final FATAL_TRUST_FAILURE = SslErrorType._internal(
'FATAL_TRUST_FAILURE',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 6
: -1);
///Indicates a failure other than that of trust evaluation.
///
///**NOTE**: available only on iOS
static const OTHER_ERROR = const SslErrorType._internal(7);
///This value indicates that evaluation failed for some other reason.
///This can be caused by either a revoked certificate or by OS-level errors that are unrelated to the certificates themselves.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SecTrustResultType.otherError](https://developer.apple.com/documentation/security/sectrustresulttype/othererror))
static final OTHER_ERROR = SslErrorType._internal(
'OTHER_ERROR',
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? 7
: -1);
bool operator ==(value) => value == _value;
@ -324,4 +352,4 @@ class IOSSslError {
@override
int get hashCode => _value.hashCode;
}
}

View File

@ -17,7 +17,7 @@ class WebResourceError {
}
return WebResourceError(
type: WebResourceErrorType.fromIntValue(map["errorCode"])!,
type: WebResourceErrorType.fromNativeValue(map["errorCode"])!,
description: map["description"]
);
}

View File

@ -3,14 +3,67 @@ import 'package:flutter/foundation.dart';
///Class that represents the error types returned by URL loading APIs.
class WebResourceErrorType {
final String _value;
final int _intValue;
final int _nativeValue;
const WebResourceErrorType._internal(this._value, this._intValue);
const WebResourceErrorType._internal(this._value, this._nativeValue);
///Set of all values of [WebResourceErrorType].
static final Set<WebResourceErrorType> values = [
WebResourceErrorType.USER_AUTHENTICATION_FAILED,
WebResourceErrorType.BAD_URL,
WebResourceErrorType.CANNOT_CONNECT_TO_HOST,
WebResourceErrorType.FAILED_SSL_HANDSHAKE,
WebResourceErrorType.GENERIC_FILE_ERROR,
WebResourceErrorType.FILE_NOT_FOUND,
WebResourceErrorType.HOST_LOOKUP,
WebResourceErrorType.IO,
WebResourceErrorType.PROXY_AUTHENTICATION,
WebResourceErrorType.TOO_MANY_REDIRECTS,
WebResourceErrorType.TIMEOUT,
WebResourceErrorType.TOO_MANY_REQUESTS,
WebResourceErrorType.UNKNOWN,
WebResourceErrorType.UNSAFE_RESOURCE,
WebResourceErrorType.UNSUPPORTED_AUTH_SCHEME,
WebResourceErrorType.UNSUPPORTED_SCHEME,
WebResourceErrorType.CANCELLED,
WebResourceErrorType.NETWORK_CONNECTION_LOST,
WebResourceErrorType.RESOURCE_UNAVAILABLE,
WebResourceErrorType.NOT_CONNECTED_TO_INTERNET,
WebResourceErrorType.REDIRECT_TO_NON_EXISTENT_LOCATION,
WebResourceErrorType.BAD_SERVER_RESPONSE,
WebResourceErrorType.USER_CANCELLED_AUTHENTICATION,
WebResourceErrorType.USER_AUTHENTICATION_REQUIRED,
WebResourceErrorType.ZERO_BYTE_RESOURCE,
WebResourceErrorType.CANNOT_DECODE_RAW_DATA,
WebResourceErrorType.CANNOT_DECODE_CONTENT_DATA,
WebResourceErrorType.CANNOT_PARSE_RESPONSE,
WebResourceErrorType.APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION,
WebResourceErrorType.FILE_IS_DIRECTORY,
WebResourceErrorType.NO_PERMISSIONS_TO_READ_FILE,
WebResourceErrorType.DATA_LENGTH_EXCEEDS_MAXIMUM,
WebResourceErrorType.SECURE_CONNECTION_FAILED,
WebResourceErrorType.SERVER_CERTIFICATE_HAS_BAD_DATE,
WebResourceErrorType.SERVER_CERTIFICATE_UNTRUSTED,
WebResourceErrorType.SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT,
WebResourceErrorType.SERVER_CERTIFICATE_NOT_YET_VALID,
WebResourceErrorType.CLIENT_CERTIFICATE_REJECTED,
WebResourceErrorType.CLIENT_CERTIFICATE_REQUIRED,
WebResourceErrorType.CANNOT_LOAD_FROM_NETWORK,
WebResourceErrorType.CANNOT_CREATE_FILE,
WebResourceErrorType.CANNOT_OPEN_FILE,
WebResourceErrorType.CANNOT_CLOSE_FILE,
WebResourceErrorType.CANNOT_WRITE_TO_FILE,
WebResourceErrorType.CANNOT_REMOVE_FILE,
WebResourceErrorType.CANNOT_MOVE_FILE,
WebResourceErrorType.DOWNLOAD_DECODING_FAILED_MID_STREAM,
WebResourceErrorType.DOWNLOAD_DECODING_FAILED_TO_COMPLETE,
WebResourceErrorType.INTERNATIONAL_ROAMING_OFF,
WebResourceErrorType.CALL_IS_ACTIVE,
WebResourceErrorType.DATA_NOT_ALLOWED,
WebResourceErrorType.REQUEST_BODY_STREAM_EXHAUSTED,
WebResourceErrorType.BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER,
WebResourceErrorType.BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS,
WebResourceErrorType.BACKGROUND_SESSION_WAS_DISCONNECTED
].toSet();
///Gets a possible [WebResourceErrorType] instance from a [String] value.
@ -27,11 +80,11 @@ class WebResourceErrorType {
}
///Gets a possible [WebResourceErrorType] instance from an [int] value.
static WebResourceErrorType? fromIntValue(int? value) {
static WebResourceErrorType? fromNativeValue(int? value) {
if (value != null) {
try {
return WebResourceErrorType.values
.firstWhere((element) => element.toIntValue() == value);
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
@ -42,8 +95,8 @@ class WebResourceErrorType {
///Gets [String] value.
String toValue() => _value;
///Gets [int] value.
int toIntValue() => _intValue;
///Gets native [int] value.
int toNativeValue() => _nativeValue;
@override
String toString() => _value;
@ -56,7 +109,7 @@ class WebResourceErrorType {
"USER_AUTHENTICATION_FAILED",
(defaultTargetPlatform != TargetPlatform.android)
? -4
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A malformed URL prevented a URL request from being initiated.
///
@ -70,7 +123,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1000
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Failed to connect to the server.
///
@ -84,7 +137,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1004
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Failed to perform SSL handshake.
///
@ -94,7 +147,7 @@ class WebResourceErrorType {
"FAILED_SSL_HANDSHAKE",
(defaultTargetPlatform != TargetPlatform.android)
? -11
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///Generic file error.
///
@ -104,7 +157,7 @@ class WebResourceErrorType {
"GENERIC_FILE_ERROR",
(defaultTargetPlatform != TargetPlatform.android)
? -13
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///File not found.
///
@ -118,7 +171,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1100
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Server or proxy hostname lookup failed.
///
@ -132,7 +185,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1003
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Failed to read or write to the server.
///
@ -142,7 +195,7 @@ class WebResourceErrorType {
"IO",
(defaultTargetPlatform != TargetPlatform.android)
? -7
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///User authentication failed on proxy.
///
@ -152,7 +205,7 @@ class WebResourceErrorType {
"PROXY_AUTHENTICATION",
(defaultTargetPlatform != TargetPlatform.android)
? -5
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A redirect loop has been detected or the threshold for number of allowable redirects has been exceeded (currently `16` on iOS).
///
@ -166,7 +219,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1007
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Connection timed out.
///
@ -180,7 +233,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1001
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///Too many requests during this load.
///
@ -190,7 +243,7 @@ class WebResourceErrorType {
"TOO_MANY_REQUESTS",
(defaultTargetPlatform != TargetPlatform.android)
? -15
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///The URL Loading System encountered an error that it cant interpret.
///
@ -207,7 +260,7 @@ class WebResourceErrorType {
"UNSAFE_RESOURCE",
(defaultTargetPlatform != TargetPlatform.android)
? -16
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///Unsupported authentication scheme (not basic or digest).
///
@ -217,7 +270,7 @@ class WebResourceErrorType {
"UNSUPPORTED_AUTH_SCHEME",
(defaultTargetPlatform != TargetPlatform.android)
? -3
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///Unsupported URI scheme.
///Typically this occurs when there is no available protocol handler for the URL.
@ -232,7 +285,7 @@ class WebResourceErrorType {
: ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1002
: UNKNOWN._intValue));
: UNKNOWN._nativeValue));
///An asynchronous load has been canceled.
///
@ -243,427 +296,436 @@ class WebResourceErrorType {
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -999
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A client or server connection was severed in the middle of an in-progress load.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.networkConnectionLost](https://developer.apple.com/documentation/foundation/urlerror/2293759-networkconnectionlost))
static final NETWORK_CONNECTION_LOST =
WebResourceErrorType._internal("NETWORK_CONNECTION_LOST",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final NETWORK_CONNECTION_LOST = WebResourceErrorType._internal(
"NETWORK_CONNECTION_LOST",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1005
: UNKNOWN._intValue);
? -1005
: UNKNOWN._nativeValue);
///A requested resource couldn't be retrieved.
///This error can indicate a file-not-found situation, or decoding problems that prevent data from being processed correctly.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.resourceUnavailable](https://developer.apple.com/documentation/foundation/urlerror/2293555-resourceunavailable))
static final RESOURCE_UNAVAILABLE =
WebResourceErrorType._internal("RESOURCE_UNAVAILABLE",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final RESOURCE_UNAVAILABLE = WebResourceErrorType._internal(
"RESOURCE_UNAVAILABLE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1008
: UNKNOWN._intValue);
? -1008
: UNKNOWN._nativeValue);
///A network resource was requested, but an internet connection hasnt been established and cant be established automatically.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.notConnectedToInternet](https://developer.apple.com/documentation/foundation/urlerror/2293104-notconnectedtointernet))
static final NOT_CONNECTED_TO_INTERNET =
WebResourceErrorType._internal("NOT_CONNECTED_TO_INTERNET",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final NOT_CONNECTED_TO_INTERNET = WebResourceErrorType._internal(
"NOT_CONNECTED_TO_INTERNET",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1009
: UNKNOWN._intValue);
? -1009
: UNKNOWN._nativeValue);
///A redirect was specified by way of server response code, but the server didnt accompany this code with a redirect URL.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.redirectToNonExistentLocation](https://developer.apple.com/documentation/foundation/urlerror/2293066-redirecttononexistentlocation))
static final REDIRECT_TO_NON_EXISTENT_LOCATION =
WebResourceErrorType._internal("REDIRECT_TO_NON_EXISTENT_LOCATION",
WebResourceErrorType._internal(
"REDIRECT_TO_NON_EXISTENT_LOCATION",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1010
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///The URL Loading System received bad data from the server.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.badServerResponse](https://developer.apple.com/documentation/foundation/urlerror/2293606-badserverresponse))
static final BAD_SERVER_RESPONSE =
WebResourceErrorType._internal("BAD_SERVER_RESPONSE",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final BAD_SERVER_RESPONSE = WebResourceErrorType._internal(
"BAD_SERVER_RESPONSE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1011
: UNKNOWN._intValue);
? -1011
: UNKNOWN._nativeValue);
///An asynchronous request for authentication has been canceled by the user.
///This error typically occurs when a user clicks a "Cancel" button in a username/password dialog, rather than attempting to authenticate.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.userCancelledAuthentication](https://developer.apple.com/documentation/foundation/urlerror/2293330-usercancelledauthentication))
static final USER_CANCELLED_AUTHENTICATION =
WebResourceErrorType._internal("USER_CANCELLED_AUTHENTICATION",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final USER_CANCELLED_AUTHENTICATION = WebResourceErrorType._internal(
"USER_CANCELLED_AUTHENTICATION",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1012
: UNKNOWN._intValue);
? -1012
: UNKNOWN._nativeValue);
///Authentication is required to access a resource.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.userAuthenticationRequired](https://developer.apple.com/documentation/foundation/urlerror/2293560-userauthenticationrequired))
static final USER_AUTHENTICATION_REQUIRED =
WebResourceErrorType._internal("USER_AUTHENTICATION_REQUIRED",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final USER_AUTHENTICATION_REQUIRED = WebResourceErrorType._internal(
"USER_AUTHENTICATION_REQUIRED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1013
: UNKNOWN._intValue);
? -1013
: UNKNOWN._nativeValue);
///A server reported that a URL has a non-zero content length, but terminated the network connection gracefully without sending any data.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.zeroByteResource](https://developer.apple.com/documentation/foundation/urlerror/2293773-zerobyteresource))
static final ZERO_BYTE_RESOURCE =
WebResourceErrorType._internal("ZERO_BYTE_RESOURCE",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final ZERO_BYTE_RESOURCE = WebResourceErrorType._internal(
"ZERO_BYTE_RESOURCE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1014
: UNKNOWN._intValue);
? -1014
: UNKNOWN._nativeValue);
///Content data received during a connection request couldnt be decoded for a known content encoding.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotDecodeRawData](https://developer.apple.com/documentation/foundation/urlerror/2293573-cannotdecoderawdata))
static final CANNOT_DECODE_RAW_DATA =
WebResourceErrorType._internal("CANNOT_DECODE_RAW_DATA",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final CANNOT_DECODE_RAW_DATA = WebResourceErrorType._internal(
"CANNOT_DECODE_RAW_DATA",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1015
: UNKNOWN._intValue);
? -1015
: UNKNOWN._nativeValue);
///Content data received during a connection request couldnt be decoded for a known content encoding.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotDecodeContentData](https://developer.apple.com/documentation/foundation/urlerror/2292983-cannotdecodecontentdata))
static final CANNOT_DECODE_CONTENT_DATA =
WebResourceErrorType._internal("CANNOT_DECODE_CONTENT_DATA",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final CANNOT_DECODE_CONTENT_DATA = WebResourceErrorType._internal(
"CANNOT_DECODE_CONTENT_DATA",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1016
: UNKNOWN._intValue);
? -1016
: UNKNOWN._nativeValue);
///A task could not parse a response.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotParseResponse](https://developer.apple.com/documentation/foundation/urlerror/code/2882919-cannotparseresponse))
static final CANNOT_PARSE_RESPONSE =
WebResourceErrorType._internal("CANNOT_PARSE_RESPONSE",
(defaultTargetPlatform != TargetPlatform.iOS ||
static final CANNOT_PARSE_RESPONSE = WebResourceErrorType._internal(
"CANNOT_PARSE_RESPONSE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1017
: UNKNOWN._intValue);
? -1017
: UNKNOWN._nativeValue);
///App Transport Security disallowed a connection because there is no secure network connection.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.appTransportSecurityRequiresSecureConnection](https://developer.apple.com/documentation/foundation/urlerror/code/2882980-apptransportsecurityrequiressecu))
static final APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION =
WebResourceErrorType._internal("APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1022
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"APP_TRANSPORT_SECURITY_REQUIRES_SECURE_CONNECTION",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1022
: UNKNOWN._nativeValue);
///A request for an FTP file resulted in the server responding that the file is not a plain file, but a directory.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.fileIsDirectory](https://developer.apple.com/documentation/foundation/urlerror/code/2883220-fileisdirectory))
static final FILE_IS_DIRECTORY =
WebResourceErrorType._internal("FILE_IS_DIRECTORY",
static final FILE_IS_DIRECTORY = WebResourceErrorType._internal(
"FILE_IS_DIRECTORY",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1101
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A resource couldnt be read because of insufficient permissions.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.noPermissionsToReadFile](https://developer.apple.com/documentation/foundation/urlerror/code/2882941-nopermissionstoreadfile))
static final NO_PERMISSIONS_TO_READ_FILE =
WebResourceErrorType._internal("NO_PERMISSIONS_TO_READ_FILE",
static final NO_PERMISSIONS_TO_READ_FILE = WebResourceErrorType._internal(
"NO_PERMISSIONS_TO_READ_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1102
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///The length of the resource data exceeds the maximum allowed.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.dataLengthExceedsMaximum](https://developer.apple.com/documentation/foundation/urlerror/code/2882930-datalengthexceedsmaximum))
static final DATA_LENGTH_EXCEEDS_MAXIMUM =
WebResourceErrorType._internal("DATA_LENGTH_EXCEEDS_MAXIMUM",
static final DATA_LENGTH_EXCEEDS_MAXIMUM = WebResourceErrorType._internal(
"DATA_LENGTH_EXCEEDS_MAXIMUM",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1103
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///An attempt to establish a secure connection failed for reasons that cant be expressed more specifically.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.secureConnectionFailed](https://developer.apple.com/documentation/foundation/urlerror/code/2883122-secureconnectionfailed))
static final SECURE_CONNECTION_FAILED =
WebResourceErrorType._internal("SECURE_CONNECTION_FAILED",
static final SECURE_CONNECTION_FAILED = WebResourceErrorType._internal(
"SECURE_CONNECTION_FAILED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1200
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A server certificate had a date which indicates it has expired, or is not yet valid.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasBadDate](https://developer.apple.com/documentation/foundation/urlerror/code/2883088-servercertificatehasbaddate))
static final SERVER_CERTIFICATE_HAS_BAD_DATE =
WebResourceErrorType._internal("SERVER_CERTIFICATE_HAS_BAD_DATE",
static final SERVER_CERTIFICATE_HAS_BAD_DATE = WebResourceErrorType._internal(
"SERVER_CERTIFICATE_HAS_BAD_DATE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1201
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A server certificate was signed by a root server that isnt trusted.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateUntrusted](https://developer.apple.com/documentation/foundation/urlerror/code/2882976-servercertificateuntrusted))
static final SERVER_CERTIFICATE_UNTRUSTED =
WebResourceErrorType._internal("SERVER_CERTIFICATE_UNTRUSTED",
static final SERVER_CERTIFICATE_UNTRUSTED = WebResourceErrorType._internal(
"SERVER_CERTIFICATE_UNTRUSTED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1202
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A server certificate was not signed by any root server.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateHasUnknownRoot](https://developer.apple.com/documentation/foundation/urlerror/code/2883085-servercertificatehasunknownroot))
static final SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT =
WebResourceErrorType._internal("SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1203
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"SERVER_CERTIFICATE_HAS_UNKNOWN_ROOT",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1203
: UNKNOWN._nativeValue);
///A server certificate is not yet valid.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.serverCertificateNotYetValid](https://developer.apple.com/documentation/foundation/urlerror/code/2882991-servercertificatenotyetvalid))
static final SERVER_CERTIFICATE_NOT_YET_VALID =
WebResourceErrorType._internal("SERVER_CERTIFICATE_NOT_YET_VALID",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1204
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"SERVER_CERTIFICATE_NOT_YET_VALID",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -1204
: UNKNOWN._nativeValue);
///A server certificate was rejected.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.clientCertificateRejected](https://developer.apple.com/documentation/foundation/urlerror/code/2883091-clientcertificaterejected))
static final CLIENT_CERTIFICATE_REJECTED =
WebResourceErrorType._internal("CLIENT_CERTIFICATE_REJECTED",
static final CLIENT_CERTIFICATE_REJECTED = WebResourceErrorType._internal(
"CLIENT_CERTIFICATE_REJECTED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1205
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A client certificate was required to authenticate an SSL connection during a request.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.clientCertificateRequired](https://developer.apple.com/documentation/foundation/urlerror/code/2883199-clientcertificaterequired))
static final CLIENT_CERTIFICATE_REQUIRED =
WebResourceErrorType._internal("CLIENT_CERTIFICATE_REQUIRED",
static final CLIENT_CERTIFICATE_REQUIRED = WebResourceErrorType._internal(
"CLIENT_CERTIFICATE_REQUIRED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1206
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A request to load an item only from the cache could not be satisfied.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotLoadFromNetwork](https://developer.apple.com/documentation/foundation/urlerror/code/2882968-cannotloadfromnetwork))
static final CANNOT_LOAD_FROM_NETWORK =
WebResourceErrorType._internal("CANNOT_LOAD_FROM_NETWORK",
static final CANNOT_LOAD_FROM_NETWORK = WebResourceErrorType._internal(
"CANNOT_LOAD_FROM_NETWORK",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -2000
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task couldnt create the downloaded file on disk because of an I/O failure.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotCreateFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883204-cannotcreatefile))
static final CANNOT_CREATE_FILE =
WebResourceErrorType._internal("CANNOT_CREATE_FILE",
static final CANNOT_CREATE_FILE = WebResourceErrorType._internal(
"CANNOT_CREATE_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3000
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task was unable to open the downloaded file on disk.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotOpenFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883034-cannotopenfile))
static final CANNOT_OPEN_FILE =
WebResourceErrorType._internal("CANNOT_OPEN_FILE",
static final CANNOT_OPEN_FILE = WebResourceErrorType._internal(
"CANNOT_OPEN_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3001
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task couldnt close the downloaded file on disk.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotCloseFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883215-cannotclosefile))
static final CANNOT_CLOSE_FILE =
WebResourceErrorType._internal("CANNOT_CLOSE_FILE",
static final CANNOT_CLOSE_FILE = WebResourceErrorType._internal(
"CANNOT_CLOSE_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3002
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task was unable to write to the downloaded file on disk.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotWriteToFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883098-cannotwritetofile))
static final CANNOT_WRITE_TO_FILE =
WebResourceErrorType._internal("CANNOT_WRITE_TO_FILE",
static final CANNOT_WRITE_TO_FILE = WebResourceErrorType._internal(
"CANNOT_WRITE_TO_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3003
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task was unable to remove a downloaded file from disk.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotRemoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883202-cannotremovefile))
static final CANNOT_REMOVE_FILE =
WebResourceErrorType._internal("CANNOT_REMOVE_FILE",
static final CANNOT_REMOVE_FILE = WebResourceErrorType._internal(
"CANNOT_REMOVE_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3004
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task was unable to move a downloaded file on disk.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.cannotMoveFile](https://developer.apple.com/documentation/foundation/urlerror/code/2883180-cannotmovefile))
static final CANNOT_MOVE_FILE =
WebResourceErrorType._internal("CANNOT_MOVE_FILE",
static final CANNOT_MOVE_FILE = WebResourceErrorType._internal(
"CANNOT_MOVE_FILE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -3005
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A download task failed to decode an encoded file during the download.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedMidStream](https://developer.apple.com/documentation/foundation/urlerror/code/2883224-downloaddecodingfailedmidstream))
static final DOWNLOAD_DECODING_FAILED_MID_STREAM =
WebResourceErrorType._internal("DOWNLOAD_DECODING_FAILED_MID_STREAM",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -3006
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"DOWNLOAD_DECODING_FAILED_MID_STREAM",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -3006
: UNKNOWN._nativeValue);
///A download task failed to decode an encoded file after downloading.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.downloadDecodingFailedToComplete](https://developer.apple.com/documentation/foundation/urlerror/code/2882936-downloaddecodingfailedtocomplete))
static final DOWNLOAD_DECODING_FAILED_TO_COMPLETE =
WebResourceErrorType._internal("DOWNLOAD_DECODING_FAILED_TO_COMPLETE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -3007
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"DOWNLOAD_DECODING_FAILED_TO_COMPLETE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -3007
: UNKNOWN._nativeValue);
///The attempted connection required activating a data context while roaming, but international roaming is disabled.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.internationalRoamingOff](https://developer.apple.com/documentation/foundation/urlerror/code/2883134-internationalroamingoff))
static final INTERNATIONAL_ROAMING_OFF =
WebResourceErrorType._internal("INTERNATIONAL_ROAMING_OFF",
static final INTERNATIONAL_ROAMING_OFF = WebResourceErrorType._internal(
"INTERNATIONAL_ROAMING_OFF",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1018
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A connection was attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS).
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.callIsActive](https://developer.apple.com/documentation/foundation/urlerror/code/2883170-callisactive))
static final CALL_IS_ACTIVE =
WebResourceErrorType._internal("CALL_IS_ACTIVE",
static final CALL_IS_ACTIVE = WebResourceErrorType._internal(
"CALL_IS_ACTIVE",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1019
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///The cellular network disallowed a connection.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.dataNotAllowed](https://developer.apple.com/documentation/foundation/urlerror/code/2883217-datanotallowed))
static final DATA_NOT_ALLOWED =
WebResourceErrorType._internal("DATA_NOT_ALLOWED",
static final DATA_NOT_ALLOWED = WebResourceErrorType._internal(
"DATA_NOT_ALLOWED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1020
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///A body stream is needed but the client did not provide one.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.requestBodyStreamExhausted](https://developer.apple.com/documentation/foundation/urlerror/code/2883176-requestbodystreamexhausted))
static final REQUEST_BODY_STREAM_EXHAUSTED =
WebResourceErrorType._internal("REQUEST_BODY_STREAM_EXHAUSTED",
static final REQUEST_BODY_STREAM_EXHAUSTED = WebResourceErrorType._internal(
"REQUEST_BODY_STREAM_EXHAUSTED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
defaultTargetPlatform != TargetPlatform.macOS)
? -1021
: UNKNOWN._intValue);
: UNKNOWN._nativeValue);
///The shared container identifier of the URL session configuration is needed but has not been set.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionRequiresSharedContainer](https://developer.apple.com/documentation/foundation/urlerror/code/2883169-backgroundsessionrequiressharedc))
static final BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER =
WebResourceErrorType._internal("BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -995
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"BACKGROUND_SESSION_REQUIRES_SHARED_CONTAINER",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -995
: UNKNOWN._nativeValue);
///An app or app extension attempted to connect to a background session that is already connected to a process.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionInUseByAnotherProcess](https://developer.apple.com/documentation/foundation/urlerror/code/2882923-backgroundsessioninusebyanotherp))
static final BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS =
WebResourceErrorType._internal("BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -996
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"BACKGROUND_SESSION_IN_USE_BY_ANOTHER_PROCESS",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -996
: UNKNOWN._nativeValue);
///The app is suspended or exits while a background data task is processing.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLError.backgroundSessionWasDisconnected](https://developer.apple.com/documentation/foundation/urlerror/code/2883075-backgroundsessionwasdisconnected))
static final BACKGROUND_SESSION_WAS_DISCONNECTED =
WebResourceErrorType._internal("BACKGROUND_SESSION_WAS_DISCONNECTED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -997
: UNKNOWN._intValue);
WebResourceErrorType._internal(
"BACKGROUND_SESSION_WAS_DISCONNECTED",
(defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
? -997
: UNKNOWN._nativeValue);
bool operator ==(value) => value == _value;