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

View File

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

View File

@ -29,7 +29,7 @@ class PermissionRequest {
List<PermissionResourceType> resources = []; List<PermissionResourceType> resources = [];
if (map["resources"] != null) { if (map["resources"] != null) {
(map["resources"].cast<dynamic>() as List<dynamic>).forEach((element) { (map["resources"].cast<dynamic>() as List<dynamic>).forEach((element) {
var resource = PermissionResourceType.fromValue(element); var resource = PermissionResourceType.fromNativeValue(element);
if (resource != null) { if (resource != null) {
resources.add(resource); 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 that represents a type of resource used to ask user's permission.
class PermissionResourceType { 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]. ///Set of all values of [PermissionResourceType].
static final Set<PermissionResourceType> values = [ static final Set<PermissionResourceType> values = [
PermissionResourceType.RESOURCE_AUDIO_CAPTURE, PermissionResourceType.MIDI_SYSEX,
PermissionResourceType.RESOURCE_MIDI_SYSEX, PermissionResourceType.PROTECTED_MEDIA_ID,
PermissionResourceType.RESOURCE_PROTECTED_MEDIA_ID,
PermissionResourceType.RESOURCE_VIDEO_CAPTURE,
PermissionResourceType.CAMERA, PermissionResourceType.CAMERA,
PermissionResourceType.MICROPHONE, PermissionResourceType.MICROPHONE,
PermissionResourceType.CAMERA_AND_MICROPHONE, PermissionResourceType.CAMERA_AND_MICROPHONE,
PermissionResourceType.DEVICE_ORIENTATION_AND_MOTION, PermissionResourceType.DEVICE_ORIENTATION_AND_MOTION,
].toSet(); ].toSet();
static final Set<PermissionResourceType> _androidValues = [ ///Gets a possible [PermissionResourceType] instance from a [String] value.
PermissionResourceType.RESOURCE_AUDIO_CAPTURE, static PermissionResourceType? fromValue(String? value) {
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) {
if (value != null) { if (value != null) {
try { try {
Set<PermissionResourceType> valueList = return PermissionResourceType.values
<PermissionResourceType>[].toSet(); .firstWhere((element) => element.toValue() == value);
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);
} catch (e) { } catch (e) {
return null; return null;
} }
@ -53,74 +30,99 @@ class PermissionResourceType {
return null; return null;
} }
///Gets the value. ///Gets a possible [PermissionResourceType] instance from a value.
dynamic toValue() => _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 @override
String toString() { String toString() => _value;
if (_value is String) {
return _value;
}
switch (_value) {
case 0:
return "CAMERA";
case 1:
return "MICROPHONE";
case 2:
return "CAMERA_AND_MICROPHONE";
default:
return "";
}
}
///Resource belongs to audio capture device, like microphone. ///Resource belongs to audio capture device, like microphone.
/// ///
///**NOTE**: available only on Android. ///**Supported Platforms/Implementations**:
static const RESOURCE_AUDIO_CAPTURE = const PermissionResourceType._internal( ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_AUDIO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE))
'android.webkit.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. ///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. ///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. ///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. ///**Supported Platforms/Implementations**:
static const RESOURCE_MIDI_SYSEX = const PermissionResourceType._internal( ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_MIDI_SYSEX](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_MIDI_SYSEX))
'android.webkit.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. ///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. ///**Supported Platforms/Implementations**:
static const RESOURCE_PROTECTED_MEDIA_ID = ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_PROTECTED_MEDIA_ID))
const PermissionResourceType._internal( static final PROTECTED_MEDIA_ID = PermissionResourceType._internal(
'android.webkit.resource.PROTECTED_MEDIA_ID'); 'PROTECTED_MEDIA_ID',
(defaultTargetPlatform != TargetPlatform.android)
? 'android.webkit.resource.PROTECTED_MEDIA_ID'
: null);
///Resource belongs to video capture device, like camera. ///Resource belongs to video capture device, like camera.
/// ///
///**NOTE**: available only on Android. ///**Supported Platforms/Implementations**:
static const RESOURCE_VIDEO_CAPTURE = const PermissionResourceType._internal( ///- Android native WebView ([Official API - PermissionRequest.RESOURCE_VIDEO_CAPTURE](https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_VIDEO_CAPTURE))
'android.webkit.resource.VIDEO_CAPTURE'); ///- iOS ([Official API - WKMediaCaptureType.camera](https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera))
static final CAMERA = PermissionResourceType._internal(
///A media device that can capture video. 'CAMERA',
/// (defaultTargetPlatform != TargetPlatform.android)
///**NOTE**: available only on iOS. ? 'android.webkit.resource.VIDEO_CAPTURE'
static const CAMERA = const PermissionResourceType._internal(0); : ((defaultTargetPlatform != TargetPlatform.iOS ||
defaultTargetPlatform != TargetPlatform.macOS)
///A media device that can capture audio. ? 0
/// : null));
///**NOTE**: available only on iOS.
static const MICROPHONE = const PermissionResourceType._internal(1);
///A media device or devices that can capture audio and video. ///A media device or devices that can capture audio and video.
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
static const CAMERA_AND_MICROPHONE = ///- iOS ([Official API - WKMediaCaptureType.cameraAndMicrophone](https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone))
const PermissionResourceType._internal(2); 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. ///Resource belongs to the devices orientation and motion.
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
static const DEVICE_ORIENTATION_AND_MOTION = ///- iOS
const PermissionResourceType._internal('deviceOrientationAndMotion'); 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; bool operator ==(value) => value == _value;

View File

@ -24,7 +24,7 @@ class SslError {
this.message}) { this.message}) {
this.code = this.code ?? this.code = this.code ??
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
SslErrorType.fromValue(this.androidError?.toValue() ?? SslErrorType.fromNativeValue(this.androidError?.toValue() ??
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
this.iosError?.toValue()); this.iosError?.toValue());
} }
@ -39,7 +39,7 @@ class SslError {
androidError: AndroidSslError.fromValue(map["code"]), androidError: AndroidSslError.fromValue(map["code"]),
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
iosError: IOSSslError.fromValue(map["code"]), iosError: IOSSslError.fromValue(map["code"]),
code: SslErrorType.fromValue(map["code"]), code: SslErrorType.fromNativeValue(map["code"]),
message: map["message"]); 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. ///Class that represents the SSL Primary error associated to the server SSL certificate.
///Used by the [ServerTrustChallenge] class. ///Used by the [ServerTrustChallenge] class.
class SslErrorType { 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]. ///Set of all values of [SslErrorType].
static final Set<SslErrorType> values = [ static final Set<SslErrorType> values = [
SslErrorType.SSL_NOTYETVALID, SslErrorType.NOT_YET_VALID,
SslErrorType.SSL_EXPIRED, SslErrorType.EXPIRED,
SslErrorType.SSL_IDMISMATCH, SslErrorType.IDMISMATCH,
SslErrorType.SSL_UNTRUSTED, SslErrorType.UNTRUSTED,
SslErrorType.SSL_DATE_INVALID, SslErrorType.DATE_INVALID,
SslErrorType.SSL_INVALID,
SslErrorType.INVALID, SslErrorType.INVALID,
SslErrorType.DENY, SslErrorType.DENY,
SslErrorType.UNSPECIFIED, SslErrorType.UNSPECIFIED,
@ -25,36 +25,12 @@ class SslErrorType {
SslErrorType.OTHER_ERROR, SslErrorType.OTHER_ERROR,
].toSet(); ].toSet();
static final Set<SslErrorType> _androidValues = [ ///Gets a possible [SslErrorType] instance from a [String] value.
SslErrorType.SSL_NOTYETVALID, static SslErrorType? fromValue(String? value) {
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) {
if (value != null) { if (value != null) {
try { try {
Set<SslErrorType> valueList = <SslErrorType>[].toSet(); return SslErrorType.values
if (defaultTargetPlatform == TargetPlatform.android) { .firstWhere((element) => element.toValue() == value);
valueList = SslErrorType._androidValues;
} else if (defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS) {
valueList = SslErrorType._appleValues;
}
return valueList.firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; return null;
} }
@ -62,107 +38,159 @@ class SslErrorType {
return null; return null;
} }
///Gets [int] value. ///Gets a possible [SslErrorType] instance from a value.
int toValue() => _value; static SslErrorType? fromNativeValue(int? value) {
if (value != null) {
@override try {
String toString() { return SslErrorType.values
if (defaultTargetPlatform == TargetPlatform.android) { .firstWhere((element) => element.toNativeValue() == value);
switch (_value) { } catch (e) {
case 1: return null;
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";
} }
} }
return ""; return null;
} }
///The certificate is not yet valid ///Gets [String] value.
/// String toValue() => _value;
///**NOTE**: available only on Android
static const SSL_NOTYETVALID = const SslErrorType._internal(0);
///The certificate has expired ///Gets native [int] value.
/// int toNativeValue() => _nativeValue;
///**NOTE**: available only on Android
static const SSL_EXPIRED = const SslErrorType._internal(1);
///Hostname mismatch @override
/// String toString() => _value;
///**NOTE**: available only on Android
static const SSL_IDMISMATCH = const SslErrorType._internal(2);
///The certificate authority is not trusted ///The certificate is not yet valid.
/// ///
///**NOTE**: available only on Android ///**Supported Platforms/Implementations**:
static const SSL_UNTRUSTED = const SslErrorType._internal(3); ///- 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 ///**Supported Platforms/Implementations**:
static const SSL_DATE_INVALID = const SslErrorType._internal(4); ///- 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 ///**Supported Platforms/Implementations**:
static const SSL_INVALID = const SslErrorType._internal(5); ///- 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 ///**Supported Platforms/Implementations**:
static const INVALID = const SslErrorType._internal(0); ///- 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 ///**Supported Platforms/Implementations**:
static const DENY = const SslErrorType._internal(3); ///- 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. ///Indicates the evaluation succeeded and the certificate is implicitly trusted, but user intent was not explicitly specified.
/// ///
///**NOTE**: available only on iOS ///This value indicates that evaluation reached an (implicitly trusted) anchor certificate without any evaluation failures,
static const UNSPECIFIED = const SslErrorType._internal(4); ///but never encountered any explicitly stated user-trust preference.
///This is the most common return value.
///Indicates a trust policy failure which can be overridden by the user. ///The Keychain Access utility refers to this value as the Use System Policy, which is the default user setting.
/// ///
///**NOTE**: available only on iOS ///When receiving this value, most apps should trust the chain.
static const RECOVERABLE_TRUST_FAILURE = const SslErrorType._internal(5);
///Indicates a trust failure which cannot be overridden by the user.
/// ///
///**NOTE**: available only on iOS ///**Supported Platforms/Implementations**:
static const FATAL_TRUST_FAILURE = const SslErrorType._internal(6); ///- 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. ///Indicates a failure other than that of trust evaluation.
/// ///
///**NOTE**: available only on iOS ///This value indicates that evaluation failed for some other reason.
static const OTHER_ERROR = const SslErrorType._internal(7); ///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; bool operator ==(value) => value == _value;

View File

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