Updated generator

This commit is contained in:
Lorenzo Pichilli 2022-05-18 03:05:06 +02:00
parent 8968353551
commit 015b5f33ab
47 changed files with 3149 additions and 1449 deletions

View File

@ -16,8 +16,9 @@
### BREAKING CHANGES ### BREAKING CHANGES
- On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`). - On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`)
- All properties of `GeolocationPermissionShowPromptResponse` cannot be `null`; - All properties of `GeolocationPermissionShowPromptResponse` cannot be `null`
- Removed `URLProtectionSpace.iosIsProxy` property
## 5.4.3+7 ## 5.4.3+7

View File

@ -119,7 +119,7 @@ class ExchangeableObjectGenerator
var defaultValueCode = var defaultValueCode =
parameter.defaultValueCode?.replaceFirst("_.", "."); parameter.defaultValueCode?.replaceFirst("_.", ".");
var constructorField = var constructorField =
'${!isNullable && defaultValueCode == null ? 'required ' : ''}$parameterType $parameterName${defaultValueCode != null ? ' = $defaultValueCode' : ''}'; '${!isNullable && defaultValueCode == null ? 'required ' : ''}${parameterType.toString().replaceFirst("_", "")} $parameterName${defaultValueCode != null ? ' = $defaultValueCode' : ''}';
if (parameter.hasDeprecated) { if (parameter.hasDeprecated) {
deprecatedFields.add(parameter); deprecatedFields.add(parameter);
constructorField = constructorField =
@ -157,6 +157,7 @@ class ExchangeableObjectGenerator
classBuffer.writeln(constructorBody classBuffer.writeln(constructorBody
.toString() .toString()
.replaceAll(className, extClassName) .replaceAll(className, extClassName)
.replaceAll("_.", ".")
.replaceAll("@ExchangeableObjectConstructor()", "")); .replaceAll("@ExchangeableObjectConstructor()", ""));
} }
} else if (constructorFields.length > 0) { } else if (constructorFields.length > 0) {
@ -192,37 +193,39 @@ class ExchangeableObjectGenerator
.replaceFirst("Use ", "") .replaceFirst("Use ", "")
.replaceFirst(" instead", "") .replaceFirst(" instead", "")
.trim(); .trim();
final fieldElement = visitor.fields[fieldName]!; final fieldElement = visitor.fields[fieldName];
final fieldTypeElement = fieldElement.type.element; if (fieldElement != null) {
final deprecatedFieldTypeElement = deprecatedField.type.element; final fieldTypeElement = fieldElement.type.element;
final deprecatedFieldTypeElement = deprecatedField.type.element;
classBuffer.write('$fieldName = $fieldName ?? '); classBuffer.write('$fieldName = $fieldName ?? ');
if (fieldTypeElement != null && deprecatedFieldTypeElement != null) { if (fieldTypeElement != null && deprecatedFieldTypeElement != null) {
final isNullable = Util.typeIsNullable(fieldElement.type); final isNullable = Util.typeIsNullable(fieldElement.type);
final deprecatedIsNullable = Util.typeIsNullable(deprecatedField.type); final deprecatedIsNullable = Util.typeIsNullable(deprecatedField.type);
final hasFromMap = hasFromMapMethod(fieldTypeElement); final hasFromMap = hasFromMapMethod(fieldTypeElement);
final hasFromNativeValue = hasFromNativeValueMethod(fieldTypeElement); final hasFromNativeValue = hasFromNativeValueMethod(fieldTypeElement);
final hasFromValue = hasFromValueMethod(fieldTypeElement); final hasFromValue = hasFromValueMethod(fieldTypeElement);
final deprecatedHasToMap = hasFromMapMethod(deprecatedFieldTypeElement); final deprecatedHasToMap = hasFromMapMethod(deprecatedFieldTypeElement);
final deprecatedHasToNativeValue = hasToNativeValueMethod(deprecatedFieldTypeElement); final deprecatedHasToNativeValue = hasToNativeValueMethod(deprecatedFieldTypeElement);
final deprecatedHasToValue = hasToValueMethod(deprecatedFieldTypeElement); final deprecatedHasToValue = hasToValueMethod(deprecatedFieldTypeElement);
if (hasFromMap && deprecatedHasToMap) { if (hasFromMap && deprecatedHasToMap) {
final hasNullableFromMap = hasNullableFromMapFactory(fieldTypeElement); final hasNullableFromMap = hasNullableFromMapFactory(fieldTypeElement);
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") + classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
".fromMap($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toMap())${!isNullable && hasNullableFromMap ? '!' : ''}"); ".fromMap($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toMap())${!isNullable && hasNullableFromMap ? '!' : ''}");
} else if (hasFromNativeValue && deprecatedHasToNativeValue) { } else if (hasFromNativeValue && deprecatedHasToNativeValue) {
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") + classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
'.fromNativeValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toNativeValue())${!isNullable ? '!' : ''}'); '.fromNativeValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toNativeValue())${!isNullable ? '!' : ''}');
} else if (hasFromValue && deprecatedHasToValue) { } else if (hasFromValue && deprecatedHasToValue) {
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") + classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
'.fromValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toValue())${!isNullable ? '!' : ''}'); '.fromValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toValue())${!isNullable ? '!' : ''}');
} else {
classBuffer.write(deprecatedFieldName);
}
} else { } else {
classBuffer.write(deprecatedFieldName); classBuffer.write(deprecatedFieldName);
} }
} else { classBuffer.writeln(';');
classBuffer.write(deprecatedFieldName);
} }
classBuffer.writeln(';');
} }
classBuffer.writeln('}'); classBuffer.writeln('}');
} else if (!hasCustomConstructor) { } else if (!hasCustomConstructor) {

View File

@ -6,7 +6,7 @@ import 'test_enum.dart';
part 'test_class.g.dart'; part 'test_class.g.dart';
///Custom docs ///Custom docs
@ExchangeableObject() // @ExchangeableObject()
@SupportedPlatforms(platforms: [ @SupportedPlatforms(platforms: [
AndroidPlatform( AndroidPlatform(
apiName: "TestClass", apiName: "TestClass",
@ -20,7 +20,7 @@ part 'test_class.g.dart';
), ),
WebPlatform(), WebPlatform(),
]) ])
class TestClass_ extends TestClass3 { class TestClass_ extends TestClass3_ {
///Docs 1 ///Docs 1
String test1; String test1;
///Docs 2 ///Docs 2
@ -51,10 +51,125 @@ class TestClass_ extends TestClass3 {
} }
class TestClass3 { @ExchangeableObject()
class TestClass3_ {
String asd; String asd;
TestClass3({required this.asd}); TestClass3_({required this.asd});
}
///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
@ExchangeableObject()
class CreateWindowAction_ extends NavigationAction_ {
///The window id. Used by [WebView] to create a new WebView.
int windowId;
///Use [isDialog] instead.
@Deprecated("Use isDialog instead")
bool? androidIsDialog;
///Indicates if the new window should be a dialog, rather than a full-size window.
@SupportedPlatforms(
platforms: [
AndroidPlatform()
]
)
bool? isDialog;
CreateWindowAction_(
{required this.windowId,
@Deprecated('Use isDialog instead')
this.androidIsDialog,
this.isDialog,
required bool isForMainFrame,
@Deprecated('Use hasGesture instead')
bool? androidHasGesture,
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect,
bool? hasGesture,
bool? isRedirect,
@Deprecated('Use navigationType instead')
// ignore: deprecated_member_use_from_same_package
TestClass3_? iosWKNavigationType,
TestClass3_? navigationType}) : super(
isForMainFrame: isForMainFrame,
hasGesture: hasGesture,
isRedirect: isRedirect,
navigationType: navigationType
);
}
///An object that contains information about an action that causes navigation to occur.
@ExchangeableObject()
class NavigationAction_ {
///Indicates whether the request was made for the main frame.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event, this is always `true`.
///Also, on Android < 21, this is always `true`.
bool isForMainFrame;
///Use [hasGesture] instead.
@Deprecated('Use hasGesture instead')
bool? androidHasGesture;
///Gets whether a gesture (such as a click) was associated with the request.
///For security reasons in certain situations this method may return `false` even though
///the sequence of events which caused the request to be created was initiated by a user
///gesture.
@SupportedPlatforms(
platforms: [
AndroidPlatform(
available: "21",
apiName: "WebResourceRequest.hasGesture",
apiUrl: "https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()",
note: "On Android < 21, this is always `false`"
)
]
)
bool? hasGesture;
///Use [isRedirect] instead.
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect;
///Gets whether the request was a result of a server-side redirect.
///
///**NOTE**: If the request is associated to the [WebView.onCreateWindow] event, this is always `false`.
///Also, on Android < 21, this is always `false`.
@SupportedPlatforms(
platforms: [
AndroidPlatform(
available: "21",
apiName: "WebResourceRequest.isRedirect",
apiUrl: "https://developer.android.com/reference/android/webkit/WebResourceRequest#isRedirect()"
)
]
)
bool? isRedirect;
///Use [navigationType] instead.
@Deprecated("Use navigationType instead")
TestClass3_? iosWKNavigationType;
///The type of action triggering the navigation.
///
///**NOTE**: available only on iOS.
TestClass3_? navigationType;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
///
///**NOTE**: available only on iOS.
bool? shouldPerformDownload;
NavigationAction_(
{required this.isForMainFrame,
@Deprecated('Use hasGesture instead') this.androidHasGesture,
this.hasGesture,
@Deprecated('Use isRedirect instead') this.androidIsRedirect,
this.isRedirect,
@Deprecated("Use navigationType instead") this.iosWKNavigationType,
this.navigationType,
this.shouldPerformDownload});
} }
class Util { class Util {

View File

@ -57,7 +57,6 @@ extension URLProtectionSpace {
"authenticationMethod": authenticationMethod, "authenticationMethod": authenticationMethod,
"distinguishedNames": distinguishedNames, "distinguishedNames": distinguishedNames,
"receivesCredentialSecurely": receivesCredentialSecurely, "receivesCredentialSecurely": receivesCredentialSecurely,
"isProxy": isProxy(),
"proxyType": proxyType "proxyType": proxyType
] ]
} }

View File

@ -1,11 +1,15 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
import 'client_cert_response_action.dart'; import 'client_cert_response_action.dart';
part 'client_cert_response.g.dart';
///Class that represents the response used by the [WebView.onReceivedClientCertRequest] event. ///Class that represents the response used by the [WebView.onReceivedClientCertRequest] event.
class ClientCertResponse { @ExchangeableObject()
class ClientCertResponse_ {
///The file path of the certificate to use. ///The file path of the certificate to use.
String certificatePath; String certificatePath;
@ -17,48 +21,28 @@ class ClientCertResponse {
String? androidKeyStoreType; String? androidKeyStoreType;
///An Android-specific property used by Java [KeyStore](https://developer.android.com/reference/java/security/KeyStore) class to get the instance. ///An Android-specific property used by Java [KeyStore](https://developer.android.com/reference/java/security/KeyStore) class to get the instance.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
String? keyStoreType; String? keyStoreType;
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge. ///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
ClientCertResponseAction? action; ClientCertResponseAction_? action;
ClientCertResponse( @ExchangeableObjectConstructor()
ClientCertResponse_(
{required this.certificatePath, {required this.certificatePath,
this.certificatePassword = "", this.certificatePassword = "",
@Deprecated('Use keyStoreType instead') @Deprecated('Use keyStoreType instead')
this.androidKeyStoreType = "PKCS12", this.androidKeyStoreType = "PKCS12",
this.keyStoreType = "PKCS12", this.keyStoreType = "PKCS12",
this.action = ClientCertResponseAction.CANCEL}) { this.action = ClientCertResponseAction_.CANCEL}) {
if (this.action == ClientCertResponseAction.PROCEED) if (this.action == ClientCertResponseAction_.PROCEED)
assert(certificatePath.isNotEmpty); assert(certificatePath.isNotEmpty);
// ignore: deprecated_member_use_from_same_package
this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType; this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType;
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android) if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android)
assert(this.keyStoreType != null); assert(this.keyStoreType != null);
} }
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"certificatePath": certificatePath,
"certificatePassword": certificatePassword,
// ignore: deprecated_member_use_from_same_package
"androidKeyStoreType": keyStoreType ?? androidKeyStoreType,
// ignore: deprecated_member_use_from_same_package
"keyStoreType": keyStoreType ?? androidKeyStoreType,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,77 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'client_cert_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onReceivedClientCertRequest] event.
class ClientCertResponse {
///The file path of the certificate to use.
String certificatePath;
///The certificate password.
String? certificatePassword;
///Use [keyStoreType] instead.
@Deprecated('Use keyStoreType instead')
String? androidKeyStoreType;
///An Android-specific property used by Java [KeyStore](https://developer.android.com/reference/java/security/KeyStore) class to get the instance.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
String? keyStoreType;
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
ClientCertResponseAction? action;
ClientCertResponse(
{required this.certificatePath,
this.certificatePassword = "",
@Deprecated('Use keyStoreType instead')
this.androidKeyStoreType = "PKCS12",
this.keyStoreType = "PKCS12",
this.action = ClientCertResponseAction.CANCEL}) {
if (this.action == ClientCertResponseAction.PROCEED)
assert(certificatePath.isNotEmpty);
this.keyStoreType = this.keyStoreType ?? this.androidKeyStoreType;
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.android)
assert(this.keyStoreType != null);
}
///Gets a possible [ClientCertResponse] instance from a [Map] value.
static ClientCertResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = ClientCertResponse(
certificatePath: map['certificatePath'],
);
instance.certificatePassword = map['certificatePassword'];
instance.androidKeyStoreType = map['keyStoreType'];
instance.keyStoreType = map['keyStoreType'];
instance.action = ClientCertResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"certificatePath": certificatePath,
"certificatePassword": certificatePassword,
"keyStoreType": keyStoreType,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'ClientCertResponse{certificatePath: $certificatePath, certificatePassword: $certificatePassword, keyStoreType: $keyStoreType, action: $action}';
}
}

View File

@ -1,25 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'client_cert_response.dart'; import 'client_cert_response.dart';
part 'client_cert_response_action.g.dart';
///Class used by [ClientCertResponse] class. ///Class used by [ClientCertResponse] class.
class ClientCertResponseAction { @ExchangeableEnum()
class ClientCertResponseAction_ {
// ignore: unused_field
final int _value; final int _value;
const ClientCertResponseAction_._internal(this._value);
const ClientCertResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
///Cancel this request. ///Cancel this request.
static const CANCEL = const ClientCertResponseAction._internal(0); static const CANCEL = const ClientCertResponseAction_._internal(0);
///Proceed with the specified certificate. ///Proceed with the specified certificate.
static const PROCEED = const ClientCertResponseAction._internal(1); static const PROCEED = const ClientCertResponseAction_._internal(1);
///Ignore the request for now. ///Ignore the request for now.
static const IGNORE = const ClientCertResponseAction._internal(2); static const IGNORE = const ClientCertResponseAction_._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'client_cert_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [ClientCertResponse] class.
class ClientCertResponseAction {
final int _value;
final int _nativeValue;
const ClientCertResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ClientCertResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
ClientCertResponseAction._internal(value, nativeValue());
///Cancel this request.
static const CANCEL = ClientCertResponseAction._internal(0, 0);
///Proceed with the specified certificate.
static const PROCEED = ClientCertResponseAction._internal(1, 1);
///Ignore the request for now.
static const IGNORE = ClientCertResponseAction._internal(2, 2);
///Set of all values of [ClientCertResponseAction].
static final Set<ClientCertResponseAction> values = [
ClientCertResponseAction.CANCEL,
ClientCertResponseAction.PROCEED,
ClientCertResponseAction.IGNORE,
].toSet();
///Gets a possible [ClientCertResponseAction] instance from [int] value.
static ClientCertResponseAction? fromValue(int? value) {
if (value != null) {
try {
return ClientCertResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ClientCertResponseAction] instance from a native value.
static ClientCertResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return ClientCertResponseAction.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'CANCEL';
case 1:
return 'PROCEED';
case 2:
return 'IGNORE';
}
return _value.toString();
}
}

View File

@ -1,52 +1,29 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'compress_format.g.dart';
///Class that represents the known formats a bitmap can be compressed into. ///Class that represents the known formats a bitmap can be compressed into.
class CompressFormat { @ExchangeableEnum()
class CompressFormat_ {
// ignore: unused_field
final String _value; final String _value;
const CompressFormat_._internal(this._value);
const CompressFormat._internal(this._value);
///Set of all values of [CompressFormat].
static final Set<CompressFormat> values = [
CompressFormat.JPEG,
CompressFormat.PNG,
CompressFormat.WEBP,
CompressFormat.WEBP_LOSSY,
CompressFormat.WEBP_LOSSLESS,
].toSet();
///Gets a possible [CompressFormat] instance from a [String] value.
static CompressFormat? fromValue(String? value) {
if (value != null) {
try {
return CompressFormat.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///Compress to the `PNG` format. ///Compress to the `PNG` format.
///PNG is lossless, so `quality` is ignored. ///PNG is lossless, so `quality` is ignored.
static const PNG = const CompressFormat._internal("PNG"); static const PNG = const CompressFormat_._internal("PNG");
///Compress to the `JPEG` format. ///Compress to the `JPEG` format.
///Quality of `0` means compress for the smallest size. ///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality. ///`100` means compress for max visual quality.
static const JPEG = const CompressFormat._internal("JPEG"); static const JPEG = const CompressFormat_._internal("JPEG");
///Compress to the `WEBP` lossy format. ///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size. ///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality. ///`100` means compress for max visual quality.
/// ///
///**NOTE**: available only on Android. ///**NOTE**: available only on Android.
static const WEBP = const CompressFormat._internal("WEBP"); static const WEBP = const CompressFormat_._internal("WEBP");
///Compress to the `WEBP` lossy format. ///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size. ///Quality of `0` means compress for the smallest size.
@ -55,7 +32,7 @@ class CompressFormat {
///**NOTE**: available only on Android. ///**NOTE**: available only on Android.
/// ///
///**NOTE for Android**: available on Android 30+. ///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSY = const CompressFormat._internal("WEBP_LOSSY"); static const WEBP_LOSSY = const CompressFormat_._internal("WEBP_LOSSY");
///Compress to the `WEBP` lossless format. ///Compress to the `WEBP` lossless format.
///Quality refers to how much effort to put into compression. ///Quality refers to how much effort to put into compression.
@ -65,10 +42,5 @@ class CompressFormat {
///**NOTE**: available only on Android. ///**NOTE**: available only on Android.
/// ///
///**NOTE for Android**: available on Android 30+. ///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSLESS = const CompressFormat._internal("WEBP_LOSSLESS"); static const WEBP_LOSSLESS = const CompressFormat_._internal("WEBP_LOSSLESS");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,107 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'compress_format.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the known formats a bitmap can be compressed into.
class CompressFormat {
final String _value;
final String _nativeValue;
const CompressFormat._internal(this._value, this._nativeValue);
// ignore: unused_element
factory CompressFormat._internalMultiPlatform(
String value, Function nativeValue) =>
CompressFormat._internal(value, nativeValue());
///Compress to the `PNG` format.
///PNG is lossless, so `quality` is ignored.
static const PNG = CompressFormat._internal('PNG', 'PNG');
///Compress to the `JPEG` format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
static const JPEG = CompressFormat._internal('JPEG', 'JPEG');
///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
///
///**NOTE**: available only on Android.
static const WEBP = CompressFormat._internal('WEBP', 'WEBP');
///Compress to the `WEBP` lossy format.
///Quality of `0` means compress for the smallest size.
///`100` means compress for max visual quality.
///
///**NOTE**: available only on Android.
///
///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSY =
CompressFormat._internal('WEBP_LOSSY', 'WEBP_LOSSY');
///Compress to the `WEBP` lossless format.
///Quality refers to how much effort to put into compression.
///A value of `0` means to compress quickly, resulting in a relatively large file size.
///`100` means to spend more time compressing, resulting in a smaller file.
///
///**NOTE**: available only on Android.
///
///**NOTE for Android**: available on Android 30+.
static const WEBP_LOSSLESS =
CompressFormat._internal('WEBP_LOSSLESS', 'WEBP_LOSSLESS');
///Set of all values of [CompressFormat].
static final Set<CompressFormat> values = [
CompressFormat.PNG,
CompressFormat.JPEG,
CompressFormat.WEBP,
CompressFormat.WEBP_LOSSY,
CompressFormat.WEBP_LOSSLESS,
].toSet();
///Gets a possible [CompressFormat] instance from [String] value.
static CompressFormat? fromValue(String? value) {
if (value != null) {
try {
return CompressFormat.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [CompressFormat] instance from a native value.
static CompressFormat? fromNativeValue(String? value) {
if (value != null) {
try {
return CompressFormat.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,45 +1,23 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
import 'console_message_level.dart'; import 'console_message_level.dart';
part 'console_message.g.dart';
///Class representing a JavaScript console message from WebCore. ///Class representing a JavaScript console message from WebCore.
///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page. ///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page.
/// ///
///To receive notifications of these messages, use the [WebView.onConsoleMessage] event. ///To receive notifications of these messages, use the [WebView.onConsoleMessage] event.
class ConsoleMessage { @ExchangeableObject()
class ConsoleMessage_ {
///Console message ///Console message
String message; String message;
///Console messsage level ///Console messsage level
ConsoleMessageLevel messageLevel; ConsoleMessageLevel_ messageLevel;
ConsoleMessage( ConsoleMessage_(
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG}); {this.message = "", this.messageLevel = ConsoleMessageLevel_.LOG});
///Gets a possible [ConsoleMessage] instance from a [Map] value.
static ConsoleMessage? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return ConsoleMessage(
message: map["message"],
messageLevel: ConsoleMessageLevel.fromValue(map["messageLevel"]) ??
ConsoleMessageLevel.LOG,
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"message": message, "messageLevel": messageLevel.toValue()};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,51 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'console_message.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing a JavaScript console message from WebCore.
///This could be a issued by a call to one of the console logging functions (e.g. console.log('...')) or a JavaScript error on the page.
///
///To receive notifications of these messages, use the [WebView.onConsoleMessage] event.
class ConsoleMessage {
///Console message
String message;
///Console messsage level
ConsoleMessageLevel messageLevel;
ConsoleMessage(
{this.message = "", this.messageLevel = ConsoleMessageLevel.LOG});
///Gets a possible [ConsoleMessage] instance from a [Map] value.
static ConsoleMessage? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = ConsoleMessage();
instance.message = map['message'];
instance.messageLevel =
ConsoleMessageLevel.fromNativeValue(map['messageLevel'])!;
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"messageLevel": messageLevel.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'ConsoleMessage{message: $message, messageLevel: $messageLevel}';
}
}

View File

@ -1,68 +1,26 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'console_message_level.g.dart';
///Class representing the level of a console message. ///Class representing the level of a console message.
class ConsoleMessageLevel { @ExchangeableEnum()
class ConsoleMessageLevel_ {
// ignore: unused_field
final int _value; final int _value;
const ConsoleMessageLevel_._internal(this._value);
const ConsoleMessageLevel._internal(this._value);
///Set of all values of [ConsoleMessageLevel].
static final Set<ConsoleMessageLevel> values = [
ConsoleMessageLevel.TIP,
ConsoleMessageLevel.LOG,
ConsoleMessageLevel.WARNING,
ConsoleMessageLevel.ERROR,
ConsoleMessageLevel.DEBUG,
].toSet();
///Gets a possible [ConsoleMessageLevel] instance from an [int] value.
static ConsoleMessageLevel? fromValue(int? value) {
if (value != null) {
try {
return ConsoleMessageLevel.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 0:
return "TIP";
case 2:
return "WARNING";
case 3:
return "ERROR";
case 4:
return "DEBUG";
case 1:
default:
return "LOG";
}
}
///Console TIP level ///Console TIP level
static const TIP = const ConsoleMessageLevel._internal(0); static const TIP = const ConsoleMessageLevel_._internal(0);
///Console LOG level ///Console LOG level
static const LOG = const ConsoleMessageLevel._internal(1); static const LOG = const ConsoleMessageLevel_._internal(1);
///Console WARNING level ///Console WARNING level
static const WARNING = const ConsoleMessageLevel._internal(2); static const WARNING = const ConsoleMessageLevel_._internal(2);
///Console ERROR level ///Console ERROR level
static const ERROR = const ConsoleMessageLevel._internal(3); static const ERROR = const ConsoleMessageLevel_._internal(3);
///Console DEBUG level ///Console DEBUG level
static const DEBUG = const ConsoleMessageLevel._internal(4); static const DEBUG = const ConsoleMessageLevel_._internal(4);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,97 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'console_message_level.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class representing the level of a console message.
class ConsoleMessageLevel {
final int _value;
final int _nativeValue;
const ConsoleMessageLevel._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ConsoleMessageLevel._internalMultiPlatform(
int value, Function nativeValue) =>
ConsoleMessageLevel._internal(value, nativeValue());
///Console TIP level
static const TIP = ConsoleMessageLevel._internal(0, 0);
///Console LOG level
static const LOG = ConsoleMessageLevel._internal(1, 1);
///Console WARNING level
static const WARNING = ConsoleMessageLevel._internal(2, 2);
///Console ERROR level
static const ERROR = ConsoleMessageLevel._internal(3, 3);
///Console DEBUG level
static const DEBUG = ConsoleMessageLevel._internal(4, 4);
///Set of all values of [ConsoleMessageLevel].
static final Set<ConsoleMessageLevel> values = [
ConsoleMessageLevel.TIP,
ConsoleMessageLevel.LOG,
ConsoleMessageLevel.WARNING,
ConsoleMessageLevel.ERROR,
ConsoleMessageLevel.DEBUG,
].toSet();
///Gets a possible [ConsoleMessageLevel] instance from [int] value.
static ConsoleMessageLevel? fromValue(int? value) {
if (value != null) {
try {
return ConsoleMessageLevel.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ConsoleMessageLevel] instance from a native value.
static ConsoleMessageLevel? fromNativeValue(int? value) {
if (value != null) {
try {
return ConsoleMessageLevel.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'TIP';
case 1:
return 'LOG';
case 2:
return 'WARNING';
case 3:
return 'ERROR';
case 4:
return 'DEBUG';
}
return _value.toString();
}
}

View File

@ -1,52 +1,26 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../content_blocker.dart'; import '../content_blocker.dart';
part 'content_blocker_action_type.g.dart';
///Class that represents the kind of action that can be used with a [ContentBlockerTrigger]. ///Class that represents the kind of action that can be used with a [ContentBlockerTrigger].
class ContentBlockerActionType { @ExchangeableEnum()
class ContentBlockerActionType_ {
// ignore: unused_field
final String _value; final String _value;
const ContentBlockerActionType_._internal(this._value);
const ContentBlockerActionType._internal(this._value);
///Set of all values of [ContentBlockerActionType].
static final Set<ContentBlockerActionType> values = [
ContentBlockerActionType.BLOCK,
ContentBlockerActionType.CSS_DISPLAY_NONE,
ContentBlockerActionType.MAKE_HTTPS,
].toSet();
///Gets a possible [ContentBlockerActionType] instance from a [String] value.
static ContentBlockerActionType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerActionType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///Stops loading of the resource. If the resource was cached, the cache is ignored. ///Stops loading of the resource. If the resource was cached, the cache is ignored.
static const BLOCK = const ContentBlockerActionType._internal('block'); static const BLOCK = const ContentBlockerActionType_._internal('block');
///Hides elements of the page based on a CSS selector. A selector field contains the selector list. Any matching element has its display property set to none, which hides it. ///Hides elements of the page based on a CSS selector. A selector field contains the selector list. Any matching element has its display property set to none, which hides it.
/// ///
///**NOTE**: on Android, JavaScript must be enabled. ///**NOTE**: on Android, JavaScript must be enabled.
static const CSS_DISPLAY_NONE = static const CSS_DISPLAY_NONE =
const ContentBlockerActionType._internal('css-display-none'); const ContentBlockerActionType_._internal('css-display-none');
///Changes a URL from http to https. URLs with a specified (nondefault) port and links using other protocols are unaffected. ///Changes a URL from http to https. URLs with a specified (nondefault) port and links using other protocols are unaffected.
static const MAKE_HTTPS = static const MAKE_HTTPS =
const ContentBlockerActionType._internal('make-https'); const ContentBlockerActionType_._internal('make-https');
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,81 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'content_blocker_action_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the kind of action that can be used with a [ContentBlockerTrigger].
class ContentBlockerActionType {
final String _value;
final String _nativeValue;
const ContentBlockerActionType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ContentBlockerActionType._internalMultiPlatform(
String value, Function nativeValue) =>
ContentBlockerActionType._internal(value, nativeValue());
///Stops loading of the resource. If the resource was cached, the cache is ignored.
static const BLOCK = ContentBlockerActionType._internal('block', 'block');
///Hides elements of the page based on a CSS selector. A selector field contains the selector list. Any matching element has its display property set to none, which hides it.
///
///**NOTE**: on Android, JavaScript must be enabled.
static const CSS_DISPLAY_NONE = ContentBlockerActionType._internal(
'css-display-none', 'css-display-none');
///Changes a URL from http to https. URLs with a specified (nondefault) port and links using other protocols are unaffected.
static const MAKE_HTTPS =
ContentBlockerActionType._internal('make-https', 'make-https');
///Set of all values of [ContentBlockerActionType].
static final Set<ContentBlockerActionType> values = [
ContentBlockerActionType.BLOCK,
ContentBlockerActionType.CSS_DISPLAY_NONE,
ContentBlockerActionType.MAKE_HTTPS,
].toSet();
///Gets a possible [ContentBlockerActionType] instance from [String] value.
static ContentBlockerActionType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerActionType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ContentBlockerActionType] instance from a native value.
static ContentBlockerActionType? fromNativeValue(String? value) {
if (value != null) {
try {
return ContentBlockerActionType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,46 +1,21 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../content_blocker.dart'; import '../content_blocker.dart';
part 'content_blocker_trigger_load_type.g.dart';
///Class that represents the possible load type for a [ContentBlockerTrigger]. ///Class that represents the possible load type for a [ContentBlockerTrigger].
class ContentBlockerTriggerLoadType { @ExchangeableEnum()
class ContentBlockerTriggerLoadType_ {
// ignore: unused_field
final String _value; final String _value;
const ContentBlockerTriggerLoadType_._internal(this._value);
const ContentBlockerTriggerLoadType._internal(this._value);
///Set of all values of [ContentBlockerTriggerLoadType].
static final Set<ContentBlockerTriggerLoadType> values = [
ContentBlockerTriggerLoadType.FIRST_PARTY,
ContentBlockerTriggerLoadType.THIRD_PARTY,
].toSet();
///Gets a possible [ContentBlockerTriggerLoadType] instance from a [String] value.
static ContentBlockerTriggerLoadType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerLoadType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource. ///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource.
static const FIRST_PARTY = static const FIRST_PARTY =
const ContentBlockerTriggerLoadType._internal('first-party'); const ContentBlockerTriggerLoadType_._internal('first-party');
///THIRD_PARTY is triggered if the resource is not from the same domain as the main page resource. ///THIRD_PARTY is triggered if the resource is not from the same domain as the main page resource.
static const THIRD_PARTY = static const THIRD_PARTY =
const ContentBlockerTriggerLoadType._internal('third-party'); const ContentBlockerTriggerLoadType_._internal('third-party');
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,75 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'content_blocker_trigger_load_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the possible load type for a [ContentBlockerTrigger].
class ContentBlockerTriggerLoadType {
final String _value;
final String _nativeValue;
const ContentBlockerTriggerLoadType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ContentBlockerTriggerLoadType._internalMultiPlatform(
String value, Function nativeValue) =>
ContentBlockerTriggerLoadType._internal(value, nativeValue());
///FIRST_PARTY is triggered only if the resource has the same scheme, domain, and port as the main page resource.
static const FIRST_PARTY =
ContentBlockerTriggerLoadType._internal('first-party', 'first-party');
///THIRD_PARTY is triggered if the resource is not from the same domain as the main page resource.
static const THIRD_PARTY =
ContentBlockerTriggerLoadType._internal('third-party', 'third-party');
///Set of all values of [ContentBlockerTriggerLoadType].
static final Set<ContentBlockerTriggerLoadType> values = [
ContentBlockerTriggerLoadType.FIRST_PARTY,
ContentBlockerTriggerLoadType.THIRD_PARTY,
].toSet();
///Gets a possible [ContentBlockerTriggerLoadType] instance from [String] value.
static ContentBlockerTriggerLoadType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerLoadType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ContentBlockerTriggerLoadType] instance from a native value.
static ContentBlockerTriggerLoadType? fromNativeValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerLoadType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,61 +1,31 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../content_blocker.dart'; import '../content_blocker.dart';
part 'content_blocker_trigger_resource_type.g.dart';
///Class that represents the possible resource type defined for a [ContentBlockerTrigger]. ///Class that represents the possible resource type defined for a [ContentBlockerTrigger].
class ContentBlockerTriggerResourceType { @ExchangeableEnum()
class ContentBlockerTriggerResourceType_ {
// ignore: unused_field
final String _value; final String _value;
const ContentBlockerTriggerResourceType_._internal(this._value);
const ContentBlockerTriggerResourceType._internal(this._value);
///Set of all values of [ContentBlockerTriggerResourceType].
static final Set<ContentBlockerTriggerResourceType> values = [
ContentBlockerTriggerResourceType.DOCUMENT,
ContentBlockerTriggerResourceType.IMAGE,
ContentBlockerTriggerResourceType.STYLE_SHEET,
ContentBlockerTriggerResourceType.SCRIPT,
ContentBlockerTriggerResourceType.FONT,
ContentBlockerTriggerResourceType.MEDIA,
ContentBlockerTriggerResourceType.SVG_DOCUMENT,
ContentBlockerTriggerResourceType.RAW,
].toSet();
///Gets a possible [ContentBlockerTriggerResourceType] instance from a [String] value.
static ContentBlockerTriggerResourceType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerResourceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
static const DOCUMENT = static const DOCUMENT =
const ContentBlockerTriggerResourceType._internal('document'); const ContentBlockerTriggerResourceType_._internal('document');
static const IMAGE = static const IMAGE =
const ContentBlockerTriggerResourceType._internal('image'); const ContentBlockerTriggerResourceType_._internal('image');
static const STYLE_SHEET = static const STYLE_SHEET =
const ContentBlockerTriggerResourceType._internal('style-sheet'); const ContentBlockerTriggerResourceType_._internal('style-sheet');
static const SCRIPT = static const SCRIPT =
const ContentBlockerTriggerResourceType._internal('script'); const ContentBlockerTriggerResourceType_._internal('script');
static const FONT = const ContentBlockerTriggerResourceType._internal('font'); static const FONT =
const ContentBlockerTriggerResourceType_._internal('font');
static const MEDIA = static const MEDIA =
const ContentBlockerTriggerResourceType._internal('media'); const ContentBlockerTriggerResourceType_._internal('media');
static const SVG_DOCUMENT = static const SVG_DOCUMENT =
const ContentBlockerTriggerResourceType._internal('svg-document'); const ContentBlockerTriggerResourceType_._internal('svg-document');
///Any untyped load ///Any untyped load
static const RAW = const ContentBlockerTriggerResourceType._internal('raw'); static const RAW = const ContentBlockerTriggerResourceType_._internal('raw');
}
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
}

View File

@ -0,0 +1,91 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'content_blocker_trigger_resource_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the possible resource type defined for a [ContentBlockerTrigger].
class ContentBlockerTriggerResourceType {
final String _value;
final String _nativeValue;
const ContentBlockerTriggerResourceType._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory ContentBlockerTriggerResourceType._internalMultiPlatform(
String value, Function nativeValue) =>
ContentBlockerTriggerResourceType._internal(value, nativeValue());
static const DOCUMENT =
ContentBlockerTriggerResourceType._internal('document', 'document');
static const IMAGE =
ContentBlockerTriggerResourceType._internal('image', 'image');
static const STYLE_SHEET =
ContentBlockerTriggerResourceType._internal('style-sheet', 'style-sheet');
static const SCRIPT =
ContentBlockerTriggerResourceType._internal('script', 'script');
static const FONT =
ContentBlockerTriggerResourceType._internal('font', 'font');
static const MEDIA =
ContentBlockerTriggerResourceType._internal('media', 'media');
static const SVG_DOCUMENT = ContentBlockerTriggerResourceType._internal(
'svg-document', 'svg-document');
///Any untyped load
static const RAW = ContentBlockerTriggerResourceType._internal('raw', 'raw');
///Set of all values of [ContentBlockerTriggerResourceType].
static final Set<ContentBlockerTriggerResourceType> values = [
ContentBlockerTriggerResourceType.DOCUMENT,
ContentBlockerTriggerResourceType.IMAGE,
ContentBlockerTriggerResourceType.STYLE_SHEET,
ContentBlockerTriggerResourceType.SCRIPT,
ContentBlockerTriggerResourceType.FONT,
ContentBlockerTriggerResourceType.MEDIA,
ContentBlockerTriggerResourceType.SVG_DOCUMENT,
ContentBlockerTriggerResourceType.RAW,
].toSet();
///Gets a possible [ContentBlockerTriggerResourceType] instance from [String] value.
static ContentBlockerTriggerResourceType? fromValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerResourceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ContentBlockerTriggerResourceType] instance from a native value.
static ContentBlockerTriggerResourceType? fromNativeValue(String? value) {
if (value != null) {
try {
return ContentBlockerTriggerResourceType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -24,7 +24,6 @@ class ContentWorld {
} }
///The default world for clients. ///The default world for clients.
// ignore: non_constant_identifier_names
static final ContentWorld DEFAULT_CLIENT = static final ContentWorld DEFAULT_CLIENT =
ContentWorld.world(name: "defaultClient"); ContentWorld.world(name: "defaultClient");
@ -32,7 +31,6 @@ class ContentWorld {
///This property contains the content world for scripts that the current webpage executes. ///This property contains the content world for scripts that the current webpage executes.
///Be careful when manipulating variables in this content world. ///Be careful when manipulating variables in this content world.
///If you modify a variable with the same name as one the webpage uses, you may unintentionally disrupt the normal operation of that page. ///If you modify a variable with the same name as one the webpage uses, you may unintentionally disrupt the normal operation of that page.
// ignore: non_constant_identifier_names
static final ContentWorld PAGE = ContentWorld.world(name: "page"); static final ContentWorld PAGE = ContentWorld.world(name: "page");
///Converts instance to a map. ///Converts instance to a map.

View File

@ -1,8 +1,13 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../cookie_manager.dart'; import '../cookie_manager.dart';
import 'http_cookie_same_site_policy.dart'; import 'http_cookie_same_site_policy.dart';
part 'cookie.g.dart';
///Class that represents a cookie returned by the [CookieManager]. ///Class that represents a cookie returned by the [CookieManager].
class Cookie { @ExchangeableObject()
class Cookie_ {
///The cookie name. ///The cookie name.
String name; String name;
@ -27,7 +32,7 @@ class Cookie {
///The cookie same site policy. ///The cookie same site policy.
/// ///
///**NOTE**: on Android it will be always `null`. ///**NOTE**: on Android it will be always `null`.
HTTPCookieSameSitePolicy? sameSite; HTTPCookieSameSitePolicy_? sameSite;
///Indicates if the cookie is secure or not. ///Indicates if the cookie is secure or not.
/// ///
@ -44,7 +49,7 @@ class Cookie {
///**NOTE**: on Android it will be always `null`. ///**NOTE**: on Android it will be always `null`.
String? path; String? path;
Cookie( Cookie_(
{required this.name, {required this.name,
required this.value, required this.value,
this.expiresDate, this.expiresDate,
@ -54,29 +59,4 @@ class Cookie {
this.isSecure, this.isSecure,
this.isHttpOnly, this.isHttpOnly,
this.path}); this.path});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"name": name,
"value": value,
"expiresDate": expiresDate,
"isSessionOnly": isSessionOnly,
"domain": domain,
"sameSite": sameSite?.toValue(),
"isSecure": isSecure,
"isHttpOnly": isHttpOnly,
"path": path
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

106
lib/src/types/cookie.g.dart Normal file
View File

@ -0,0 +1,106 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'cookie.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a cookie returned by the [CookieManager].
class Cookie {
///The cookie name.
String name;
///The cookie value.
dynamic value;
///The cookie expiration date in milliseconds.
///
///**NOTE**: on Android it will be always `null`.
int? expiresDate;
///Indicates if the cookie is a session only cookie.
///
///**NOTE**: on Android it will be always `null`.
bool? isSessionOnly;
///The cookie domain.
///
///**NOTE**: on Android it will be always `null`.
String? domain;
///The cookie same site policy.
///
///**NOTE**: on Android it will be always `null`.
HTTPCookieSameSitePolicy? sameSite;
///Indicates if the cookie is secure or not.
///
///**NOTE**: on Android it will be always `null`.
bool? isSecure;
///Indicates if the cookie is a http only cookie.
///
///**NOTE**: on Android it will be always `null`.
bool? isHttpOnly;
///The cookie path.
///
///**NOTE**: on Android it will be always `null`.
String? path;
Cookie(
{required this.name,
this.value,
this.expiresDate,
this.isSessionOnly,
this.domain,
this.sameSite,
this.isSecure,
this.isHttpOnly,
this.path});
///Gets a possible [Cookie] instance from a [Map] value.
static Cookie? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = Cookie(
name: map['name'],
value: map['value'],
);
instance.expiresDate = map['expiresDate'];
instance.isSessionOnly = map['isSessionOnly'];
instance.domain = map['domain'];
instance.sameSite =
HTTPCookieSameSitePolicy.fromNativeValue(map['sameSite']);
instance.isSecure = map['isSecure'];
instance.isHttpOnly = map['isHttpOnly'];
instance.path = map['path'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"name": name,
"value": value,
"expiresDate": expiresDate,
"isSessionOnly": isSessionOnly,
"domain": domain,
"sameSite": sameSite?.toNativeValue(),
"isSecure": isSecure,
"isHttpOnly": isHttpOnly,
"path": path,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'Cookie{name: $name, value: $value, expiresDate: $expiresDate, isSessionOnly: $isSessionOnly, domain: $domain, sameSite: $sameSite, isSecure: $isSecure, isHttpOnly: $isHttpOnly, path: $path}';
}
}

View File

@ -1,3 +1,5 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
import 'navigation_action.dart'; import 'navigation_action.dart';
import 'window_features.dart'; import 'window_features.dart';
@ -5,8 +7,11 @@ import 'url_request.dart';
import 'frame_info.dart'; import 'frame_info.dart';
import 'navigation_type.dart'; import 'navigation_type.dart';
part 'create_window_action.g.dart';
///Class that represents the navigation request used by the [WebView.onCreateWindow] event. ///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
class CreateWindowAction extends NavigationAction { @ExchangeableObject()
class CreateWindowAction_ extends NavigationAction_ {
///The window id. Used by [WebView] to create a new WebView. ///The window id. Used by [WebView] to create a new WebView.
int windowId; int windowId;
@ -15,20 +20,29 @@ class CreateWindowAction extends NavigationAction {
bool? androidIsDialog; bool? androidIsDialog;
///Indicates if the new window should be a dialog, rather than a full-size window. ///Indicates if the new window should be a dialog, rather than a full-size window.
/// @SupportedPlatforms(
///**NOTE**: available only on Android. platforms: [
AndroidPlatform()
]
)
bool? isDialog; bool? isDialog;
///Use [windowFeatures] instead. ///Use [windowFeatures] instead.
@Deprecated("Use windowFeatures instead") @Deprecated("Use windowFeatures instead")
IOSWKWindowFeatures? iosWindowFeatures; IOSWKWindowFeatures_? iosWindowFeatures;
///Window features requested by the webpage. ///Window features requested by the webpage.
/// @SupportedPlatforms(
///**NOTE**: available only on iOS. platforms: [
WindowFeatures? windowFeatures; IOSPlatform(
apiName: "WKWindowFeatures",
apiUrl: "https://developer.apple.com/documentation/webkit/wkwindowfeatures"
)
]
)
WindowFeatures_? windowFeatures;
CreateWindowAction( CreateWindowAction_(
{required this.windowId, {required this.windowId,
@Deprecated('Use isDialog instead') @Deprecated('Use isDialog instead')
this.androidIsDialog, this.androidIsDialog,
@ -36,7 +50,7 @@ class CreateWindowAction extends NavigationAction {
@Deprecated('Use windowFeatures instead') @Deprecated('Use windowFeatures instead')
this.iosWindowFeatures, this.iosWindowFeatures,
this.windowFeatures, this.windowFeatures,
required URLRequest request, required URLRequest_ request,
required bool isForMainFrame, required bool isForMainFrame,
@Deprecated('Use hasGesture instead') @Deprecated('Use hasGesture instead')
bool? androidHasGesture, bool? androidHasGesture,
@ -46,113 +60,27 @@ class CreateWindowAction extends NavigationAction {
bool? isRedirect, bool? isRedirect,
@Deprecated('Use navigationType instead') @Deprecated('Use navigationType instead')
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
IOSWKNavigationType? iosWKNavigationType, IOSWKNavigationType_? iosWKNavigationType,
NavigationType? navigationType, NavigationType_? navigationType,
@Deprecated('Use sourceFrame instead') @Deprecated('Use sourceFrame instead')
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo? iosSourceFrame, IOSWKFrameInfo_? iosSourceFrame,
FrameInfo? sourceFrame, FrameInfo_? sourceFrame,
@Deprecated('Use targetFrame instead') @Deprecated('Use targetFrame instead')
// ignore: deprecated_member_use_from_same_package // ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo? iosTargetFrame, IOSWKFrameInfo_? iosTargetFrame,
FrameInfo? targetFrame}) FrameInfo_? targetFrame})
: super( : super(
request: request, request: request,
isForMainFrame: isForMainFrame, isForMainFrame: isForMainFrame,
// ignore: deprecated_member_use_from_same_package androidHasGesture: androidHasGesture,
androidHasGesture: hasGesture ?? androidHasGesture, hasGesture: hasGesture,
hasGesture: hasGesture ?? androidHasGesture, androidIsRedirect: androidIsRedirect,
// ignore: deprecated_member_use_from_same_package isRedirect: isRedirect,
androidIsRedirect: isRedirect ?? androidIsRedirect, iosWKNavigationType: iosWKNavigationType,
isRedirect: isRedirect ?? androidIsRedirect, navigationType: navigationType,
// ignore: deprecated_member_use_from_same_package iosSourceFrame: iosSourceFrame,
iosWKNavigationType: sourceFrame: sourceFrame,
// ignore: deprecated_member_use_from_same_package iosTargetFrame: iosTargetFrame,
IOSWKNavigationType.fromValue(navigationType?.toValue()) ?? targetFrame: targetFrame);
iosWKNavigationType,
navigationType: navigationType ??
NavigationType.fromValue(iosWKNavigationType?.toValue()),
// ignore: deprecated_member_use_from_same_package
iosSourceFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(sourceFrame?.toMap()) ?? iosSourceFrame,
sourceFrame:
sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap()),
// ignore: deprecated_member_use_from_same_package
iosTargetFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(targetFrame?.toMap()) ?? iosTargetFrame,
targetFrame:
targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap())) {
// ignore: deprecated_member_use_from_same_package
this.isDialog = this.isDialog ?? this.androidIsDialog;
this.windowFeatures = this.windowFeatures ??
// ignore: deprecated_member_use_from_same_package
WindowFeatures.fromMap(this.iosWindowFeatures?.toMap());
}
///Gets a possible [CreateWindowAction] instance from a [Map] value.
static CreateWindowAction? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return CreateWindowAction(
windowId: map["windowId"],
// ignore: deprecated_member_use_from_same_package
androidIsDialog: map["isDialog"] ?? map["androidIsDialog"],
isDialog: map["isDialog"] ?? map["androidIsDialog"],
// ignore: deprecated_member_use_from_same_package
iosWindowFeatures: IOSWKWindowFeatures.fromMap(
map["windowFeatures"]?.cast<String, dynamic>()),
windowFeatures: WindowFeatures.fromMap(
map["windowFeatures"]?.cast<String, dynamic>()),
request: URLRequest.fromMap(map["request"].cast<String, dynamic>())!,
isForMainFrame: map["isForMainFrame"],
// ignore: deprecated_member_use_from_same_package
androidHasGesture: map["hasGesture"],
hasGesture: map["hasGesture"],
// ignore: deprecated_member_use_from_same_package
androidIsRedirect: map["isRedirect"],
isRedirect: map["isRedirect"],
// ignore: deprecated_member_use_from_same_package
iosWKNavigationType:
// ignore: deprecated_member_use_from_same_package
IOSWKNavigationType.fromValue(map["navigationType"]),
navigationType: NavigationType.fromValue(map["navigationType"]),
// ignore: deprecated_member_use_from_same_package
iosSourceFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
sourceFrame:
FrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
// ignore: deprecated_member_use_from_same_package
iosTargetFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
targetFrame:
FrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()));
}
@override
Map<String, dynamic> toMap() {
var createWindowActionMap = super.toMap();
createWindowActionMap.addAll({
"windowId": windowId,
// ignore: deprecated_member_use_from_same_package
"androidIsDialog": isDialog ?? androidIsDialog,
// ignore: deprecated_member_use_from_same_package
"isDialog": isDialog ?? androidIsDialog,
"iosWindowFeatures":
// ignore: deprecated_member_use_from_same_package
windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(),
// ignore: deprecated_member_use_from_same_package
"windowFeatures": windowFeatures?.toMap() ?? iosWindowFeatures?.toMap(),
});
return createWindowActionMap;
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,140 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'create_window_action.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the navigation request used by the [WebView.onCreateWindow] event.
class CreateWindowAction extends NavigationAction {
///The window id. Used by [WebView] to create a new WebView.
int windowId;
///Use [isDialog] instead.
@Deprecated('Use isDialog instead')
bool? androidIsDialog;
///Indicates if the new window should be a dialog, rather than a full-size window.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
bool? isDialog;
///Use [windowFeatures] instead.
@Deprecated('Use windowFeatures instead')
IOSWKWindowFeatures? iosWindowFeatures;
///Window features requested by the webpage.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKWindowFeatures](https://developer.apple.com/documentation/webkit/wkwindowfeatures))
WindowFeatures? windowFeatures;
CreateWindowAction(
{required this.windowId,
@Deprecated('Use isDialog instead')
this.androidIsDialog,
this.isDialog,
@Deprecated('Use windowFeatures instead')
this.iosWindowFeatures,
this.windowFeatures,
required URLRequest request,
required bool isForMainFrame,
@Deprecated('Use hasGesture instead')
bool? androidHasGesture,
bool? hasGesture,
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect,
bool? isRedirect,
@Deprecated('Use navigationType instead')
IOSWKNavigationType? iosWKNavigationType,
NavigationType? navigationType,
@Deprecated('Use sourceFrame instead')
IOSWKFrameInfo? iosSourceFrame,
FrameInfo? sourceFrame,
@Deprecated('Use targetFrame instead')
IOSWKFrameInfo? iosTargetFrame,
FrameInfo? targetFrame,
bool? shouldPerformDownload})
: super(
request: request,
isForMainFrame: isForMainFrame,
androidHasGesture: androidHasGesture,
hasGesture: hasGesture,
androidIsRedirect: androidIsRedirect,
isRedirect: isRedirect,
iosWKNavigationType: iosWKNavigationType,
navigationType: navigationType,
iosSourceFrame: iosSourceFrame,
sourceFrame: sourceFrame,
iosTargetFrame: iosTargetFrame,
targetFrame: targetFrame,
shouldPerformDownload: shouldPerformDownload) {
isDialog = isDialog ?? androidIsDialog;
windowFeatures =
windowFeatures ?? WindowFeatures.fromMap(iosWindowFeatures?.toMap());
}
///Gets a possible [CreateWindowAction] instance from a [Map] value.
static CreateWindowAction? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = CreateWindowAction(
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
isForMainFrame: map['isForMainFrame'],
windowId: map['windowId'],
);
instance.androidHasGesture = map['hasGesture'];
instance.hasGesture = map['hasGesture'];
instance.androidIsRedirect = map['isRedirect'];
instance.isRedirect = map['isRedirect'];
instance.iosWKNavigationType =
IOSWKNavigationType.fromNativeValue(map['navigationType']);
instance.navigationType =
NavigationType.fromNativeValue(map['navigationType']);
instance.iosSourceFrame =
IOSWKFrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>());
instance.sourceFrame =
FrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>());
instance.iosTargetFrame =
IOSWKFrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>());
instance.targetFrame =
FrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>());
instance.shouldPerformDownload = map['shouldPerformDownload'];
instance.androidIsDialog = map['isDialog'];
instance.isDialog = map['isDialog'];
instance.iosWindowFeatures = IOSWKWindowFeatures.fromMap(
map['windowFeatures']?.cast<String, dynamic>());
instance.windowFeatures =
WindowFeatures.fromMap(map['windowFeatures']?.cast<String, dynamic>());
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"request": request.toMap(),
"isForMainFrame": isForMainFrame,
"hasGesture": hasGesture,
"isRedirect": isRedirect,
"navigationType": navigationType?.toNativeValue(),
"sourceFrame": sourceFrame?.toMap(),
"targetFrame": targetFrame?.toMap(),
"shouldPerformDownload": shouldPerformDownload,
"windowId": windowId,
"isDialog": isDialog,
"windowFeatures": windowFeatures?.toMap(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'CreateWindowAction{request: $request, isForMainFrame: $isForMainFrame, hasGesture: $hasGesture, isRedirect: $isRedirect, navigationType: $navigationType, sourceFrame: $sourceFrame, targetFrame: $targetFrame, shouldPerformDownload: $shouldPerformDownload, windowId: $windowId, isDialog: $isDialog, windowFeatures: $windowFeatures}';
}
}

View File

@ -1,47 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'script_html_tag_attributes.dart'; import 'script_html_tag_attributes.dart';
import 'css_link_html_tag_attributes.dart'; import 'css_link_html_tag_attributes.dart';
part 'cross_origin.g.dart';
///Class that represents the `crossorigin` content attribute on media elements, which is a CORS settings attribute. ///Class that represents the `crossorigin` content attribute on media elements, which is a CORS settings attribute.
///It could be used with [ScriptHtmlTagAttributes] and [CSSLinkHtmlTagAttributes] ///It could be used with [ScriptHtmlTagAttributes] and [CSSLinkHtmlTagAttributes]
///when fetching a resource `<link>` or a `<script>` (or resources fetched by the `<script>`). ///when fetching a resource `<link>` or a `<script>` (or resources fetched by the `<script>`).
class CrossOrigin { @ExchangeableEnum()
class CrossOrigin_ {
// ignore: unused_field
final String _value; final String _value;
const CrossOrigin_._internal(this._value);
const CrossOrigin._internal(this._value);
///Set of all values of [CrossOrigin].
static final Set<CrossOrigin> values = [
CrossOrigin.ANONYMOUS,
CrossOrigin.USE_CREDENTIALS,
].toSet();
///Gets a possible [CrossOrigin] instance from a [String] value.
static CrossOrigin? fromValue(String? value) {
if (value != null) {
try {
return CrossOrigin.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///CORS requests for this element will have the credentials flag set to 'same-origin'. ///CORS requests for this element will have the credentials flag set to 'same-origin'.
static const ANONYMOUS = const CrossOrigin._internal("anonymous"); static const ANONYMOUS = const CrossOrigin_._internal("anonymous");
///CORS requests for this element will have the credentials flag set to 'include'. ///CORS requests for this element will have the credentials flag set to 'include'.
static const USE_CREDENTIALS = const CrossOrigin._internal("use-credentials"); static const USE_CREDENTIALS = const CrossOrigin_._internal("use-credentials");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,76 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'cross_origin.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the `crossorigin` content attribute on media elements, which is a CORS settings attribute.
///It could be used with [ScriptHtmlTagAttributes] and [CSSLinkHtmlTagAttributes]
///when fetching a resource `<link>` or a `<script>` (or resources fetched by the `<script>`).
class CrossOrigin {
final String _value;
final String _nativeValue;
const CrossOrigin._internal(this._value, this._nativeValue);
// ignore: unused_element
factory CrossOrigin._internalMultiPlatform(
String value, Function nativeValue) =>
CrossOrigin._internal(value, nativeValue());
///CORS requests for this element will have the credentials flag set to 'same-origin'.
static const ANONYMOUS = CrossOrigin._internal('anonymous', 'anonymous');
///CORS requests for this element will have the credentials flag set to 'include'.
static const USE_CREDENTIALS =
CrossOrigin._internal('use-credentials', 'use-credentials');
///Set of all values of [CrossOrigin].
static final Set<CrossOrigin> values = [
CrossOrigin.ANONYMOUS,
CrossOrigin.USE_CREDENTIALS,
].toSet();
///Gets a possible [CrossOrigin] instance from [String] value.
static CrossOrigin? fromValue(String? value) {
if (value != null) {
try {
return CrossOrigin.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [CrossOrigin] instance from a native value.
static CrossOrigin? fromNativeValue(String? value) {
if (value != null) {
try {
return CrossOrigin.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,50 +1,24 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_request.dart'; import 'url_request.dart';
import 'security_origin.dart'; import 'security_origin.dart';
part 'frame_info.g.dart';
///An object that contains information about a frame on a webpage. ///An object that contains information about a frame on a webpage.
class FrameInfo { @ExchangeableObject()
class FrameInfo_ {
///A Boolean value indicating whether the frame is the web site's main frame or a subframe. ///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
bool isMainFrame; bool isMainFrame;
///The frames current request. ///The frames current request.
URLRequest? request; URLRequest_? request;
///The frames security origin. ///The frames security origin.
SecurityOrigin? securityOrigin; SecurityOrigin_? securityOrigin;
FrameInfo( FrameInfo_(
{required this.isMainFrame, required this.request, this.securityOrigin}); {required this.isMainFrame, required this.request, this.securityOrigin});
///Gets a possible [FrameInfo] instance from a [Map] value.
static FrameInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return FrameInfo(
isMainFrame: map["isMainFrame"],
request: URLRequest.fromMap(map["request"]?.cast<String, dynamic>()),
securityOrigin: SecurityOrigin.fromMap(
map["securityOrigin"]?.cast<String, dynamic>()));
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin?.toMap()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }
///An object that contains information about a frame on a webpage. ///An object that contains information about a frame on a webpage.
@ -53,47 +27,17 @@ class FrameInfo {
/// ///
///Use [FrameInfo] instead. ///Use [FrameInfo] instead.
@Deprecated("Use FrameInfo instead") @Deprecated("Use FrameInfo instead")
class IOSWKFrameInfo { @ExchangeableObject()
class IOSWKFrameInfo_ {
///A Boolean value indicating whether the frame is the web site's main frame or a subframe. ///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
bool isMainFrame; bool isMainFrame;
///The frames current request. ///The frames current request.
URLRequest? request; URLRequest_? request;
///The frames security origin. ///The frames security origin.
IOSWKSecurityOrigin? securityOrigin; IOSWKSecurityOrigin_? securityOrigin;
IOSWKFrameInfo( IOSWKFrameInfo_(
{required this.isMainFrame, required this.request, this.securityOrigin}); {required this.isMainFrame, required this.request, this.securityOrigin});
///Gets a possible [IOSWKFrameInfo] instance from a [Map] value.
static IOSWKFrameInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return IOSWKFrameInfo(
isMainFrame: map["isMainFrame"],
request: URLRequest.fromMap(map["request"]?.cast<String, dynamic>()),
securityOrigin: IOSWKSecurityOrigin.fromMap(
map["securityOrigin"]?.cast<String, dynamic>()));
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin?.toMap()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,103 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'frame_info.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///An object that contains information about a frame on a webpage.
class FrameInfo {
///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
bool isMainFrame;
///The frames current request.
URLRequest? request;
///The frames security origin.
dynamic securityOrigin;
FrameInfo({required this.isMainFrame, this.request, this.securityOrigin});
///Gets a possible [FrameInfo] instance from a [Map] value.
static FrameInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FrameInfo(
isMainFrame: map['isMainFrame'],
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>()),
);
instance.securityOrigin = map['securityOrigin'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FrameInfo{isMainFrame: $isMainFrame, request: $request, securityOrigin: $securityOrigin}';
}
}
///An object that contains information about a frame on a webpage.
///
///**NOTE**: available only on iOS.
///
///Use [FrameInfo] instead.
@Deprecated('Use FrameInfo instead')
class IOSWKFrameInfo {
///A Boolean value indicating whether the frame is the web site's main frame or a subframe.
bool isMainFrame;
///The frames current request.
URLRequest? request;
///The frames security origin.
dynamic securityOrigin;
IOSWKFrameInfo(
{required this.isMainFrame, this.request, this.securityOrigin});
///Gets a possible [IOSWKFrameInfo] instance from a [Map] value.
static IOSWKFrameInfo? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = IOSWKFrameInfo(
isMainFrame: map['isMainFrame'],
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>()),
);
instance.securityOrigin = map['securityOrigin'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'IOSWKFrameInfo{isMainFrame: $isMainFrame, request: $request, securityOrigin: $securityOrigin}';
}
}

View File

@ -1,56 +1,30 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'cookie.dart'; import 'cookie.dart';
part 'http_cookie_same_site_policy.g.dart';
///Class that represents the same site policy of a cookie. Used by the [Cookie] class. ///Class that represents the same site policy of a cookie. Used by the [Cookie] class.
class HTTPCookieSameSitePolicy { @ExchangeableEnum()
class HTTPCookieSameSitePolicy_ {
// ignore: unused_field
final String _value; final String _value;
const HTTPCookieSameSitePolicy_._internal(this._value);
const HTTPCookieSameSitePolicy._internal(this._value);
///Set of all values of [HTTPCookieSameSitePolicy].
static final Set<HTTPCookieSameSitePolicy> values = [
HTTPCookieSameSitePolicy.LAX,
HTTPCookieSameSitePolicy.STRICT,
HTTPCookieSameSitePolicy.NONE,
].toSet();
///Gets a possible [HTTPCookieSameSitePolicy] instance from a [String] value.
static HTTPCookieSameSitePolicy? fromValue(String? value) {
if (value != null) {
try {
return HTTPCookieSameSitePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///SameSite=Lax; ///SameSite=Lax;
/// ///
///Cookies are allowed to be sent with top-level navigations and will be sent along with GET ///Cookies are allowed to be sent with top-level navigations and will be sent along with GET
///request initiated by third party website. This is the default value in modern browsers. ///request initiated by third party website. This is the default value in modern browsers.
static const LAX = const HTTPCookieSameSitePolicy._internal("Lax"); static const LAX = const HTTPCookieSameSitePolicy_._internal("Lax");
///SameSite=Strict; ///SameSite=Strict;
/// ///
///Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites. ///Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
static const STRICT = const HTTPCookieSameSitePolicy._internal("Strict"); static const STRICT = const HTTPCookieSameSitePolicy_._internal("Strict");
///SameSite=None; ///SameSite=None;
/// ///
///Cookies will be sent in all contexts, i.e sending cross-origin is allowed. ///Cookies will be sent in all contexts, i.e sending cross-origin is allowed.
///`None` requires the `Secure` attribute in latest browser versions. ///`None` requires the `Secure` attribute in latest browser versions.
static const NONE = const HTTPCookieSameSitePolicy._internal("None"); static const NONE = const HTTPCookieSameSitePolicy_._internal("None");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'http_cookie_same_site_policy.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the same site policy of a cookie. Used by the [Cookie] class.
class HTTPCookieSameSitePolicy {
final String _value;
final String _nativeValue;
const HTTPCookieSameSitePolicy._internal(this._value, this._nativeValue);
// ignore: unused_element
factory HTTPCookieSameSitePolicy._internalMultiPlatform(
String value, Function nativeValue) =>
HTTPCookieSameSitePolicy._internal(value, nativeValue());
///SameSite=Lax;
///
///Cookies are allowed to be sent with top-level navigations and will be sent along with GET
///request initiated by third party website. This is the default value in modern browsers.
static const LAX = HTTPCookieSameSitePolicy._internal('Lax', 'Lax');
///SameSite=Strict;
///
///Cookies will only be sent in a first-party context and not be sent along with requests initiated by third party websites.
static const STRICT = HTTPCookieSameSitePolicy._internal('Strict', 'Strict');
///SameSite=None;
///
///Cookies will be sent in all contexts, i.e sending cross-origin is allowed.
///`None` requires the `Secure` attribute in latest browser versions.
static const NONE = HTTPCookieSameSitePolicy._internal('None', 'None');
///Set of all values of [HTTPCookieSameSitePolicy].
static final Set<HTTPCookieSameSitePolicy> values = [
HTTPCookieSameSitePolicy.LAX,
HTTPCookieSameSitePolicy.STRICT,
HTTPCookieSameSitePolicy.NONE,
].toSet();
///Gets a possible [HTTPCookieSameSitePolicy] instance from [String] value.
static HTTPCookieSameSitePolicy? fromValue(String? value) {
if (value != null) {
try {
return HTTPCookieSameSitePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [HTTPCookieSameSitePolicy] instance from a native value.
static HTTPCookieSameSitePolicy? fromNativeValue(String? value) {
if (value != null) {
try {
return HTTPCookieSameSitePolicy.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
///Gets [String] native value.
String toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
return _value;
}
}

View File

@ -1,17 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
import 'url_request.dart'; import 'url_request.dart';
import 'navigation_type.dart'; import 'navigation_type.dart';
import 'frame_info.dart'; import 'frame_info.dart';
part 'navigation_action.g.dart';
///An object that contains information about an action that causes navigation to occur. ///An object that contains information about an action that causes navigation to occur.
class NavigationAction { @ExchangeableObject()
class NavigationAction_ {
///The URL request object associated with the navigation action. ///The URL request object associated with the navigation action.
/// ///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event ///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event
///and the window has been created using JavaScript, [request.url] will be `null`, ///and the window has been created using JavaScript, [request.url] will be `null`,
///the [request.method] is always `GET`, and [request.headers] value is always `null`. ///the [request.method] is always `GET`, and [request.headers] value is always `null`.
///Also, on Android < 21, the [request.method] is always `GET` and [request.headers] value is always `null`. ///Also, on Android < 21, the [request.method] is always `GET` and [request.headers] value is always `null`.
URLRequest request; URLRequest_ request;
///Indicates whether the request was made for the main frame. ///Indicates whether the request was made for the main frame.
/// ///
@ -27,8 +32,16 @@ class NavigationAction {
///For security reasons in certain situations this method may return `false` even though ///For security reasons in certain situations this method may return `false` even though
///the sequence of events which caused the request to be created was initiated by a user ///the sequence of events which caused the request to be created was initiated by a user
///gesture. ///gesture.
/// @SupportedPlatforms(
///**NOTE**: available only on Android. On Android < 24, this is always `false`. platforms: [
AndroidPlatform(
available: "21",
apiName: "WebResourceRequest.hasGesture",
apiUrl: "https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()",
note: "On Android < 21, this is always `false`"
)
]
)
bool? hasGesture; bool? hasGesture;
///Use [isRedirect] instead. ///Use [isRedirect] instead.
@ -37,44 +50,77 @@ class NavigationAction {
///Gets whether the request was a result of a server-side redirect. ///Gets whether the request was a result of a server-side redirect.
/// ///
///**NOTE**: available only on Android. ///**NOTE**: If the request is associated to the [WebView.onCreateWindow] event, this is always `false`.
///If the request is associated to the [WebView.onCreateWindow] event, this is always `false`.
///Also, on Android < 21, this is always `false`. ///Also, on Android < 21, this is always `false`.
@SupportedPlatforms(
platforms: [
AndroidPlatform(
available: "21",
apiName: "WebResourceRequest.isRedirect",
apiUrl: "https://developer.android.com/reference/android/webkit/WebResourceRequest#isRedirect()"
)
]
)
bool? isRedirect; bool? isRedirect;
///Use [navigationType] instead. ///Use [navigationType] instead.
@Deprecated("Use navigationType instead") @Deprecated("Use navigationType instead")
IOSWKNavigationType? iosWKNavigationType; IOSWKNavigationType_? iosWKNavigationType;
///The type of action triggering the navigation. ///The type of action triggering the navigation.ì
/// @SupportedPlatforms(
///**NOTE**: available only on iOS. platforms: [
NavigationType? navigationType; IOSPlatform(
apiName: "WKNavigationAction.navigationType",
apiUrl: "https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype"
)
]
)
NavigationType_? navigationType;
///Use [sourceFrame] instead. ///Use [sourceFrame] instead.
@Deprecated("Use sourceFrame instead") @Deprecated("Use sourceFrame instead")
IOSWKFrameInfo? iosSourceFrame; IOSWKFrameInfo_? iosSourceFrame;
///The frame that requested the navigation. ///The frame that requested the navigation.
/// @SupportedPlatforms(
///**NOTE**: available only on iOS. platforms: [
FrameInfo? sourceFrame; IOSPlatform(
apiName: "WKNavigationAction.sourceFrame",
apiUrl: "https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe"
)
]
)
FrameInfo_? sourceFrame;
///Use [targetFrame] instead. ///Use [targetFrame] instead.
@Deprecated("Use targetFrame instead") @Deprecated("Use targetFrame instead")
IOSWKFrameInfo? iosTargetFrame; IOSWKFrameInfo_? iosTargetFrame;
///The frame in which to display the new content. ///The frame in which to display the new content.
/// @SupportedPlatforms(
///**NOTE**: available only on iOS. platforms: [
FrameInfo? targetFrame; IOSPlatform(
apiName: "WKNavigationAction.targetFrame",
apiUrl: "https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe"
)
]
)
FrameInfo_? targetFrame;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded. ///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
/// @SupportedPlatforms(
///**NOTE**: available only on iOS. platforms: [
IOSPlatform(
available: "14.5",
apiName: "WKNavigationAction.shouldPerformDownload",
apiUrl: "https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload"
)
]
)
bool? shouldPerformDownload; bool? shouldPerformDownload;
NavigationAction( NavigationAction_(
{required this.request, {required this.request,
required this.isForMainFrame, required this.isForMainFrame,
@Deprecated('Use hasGesture instead') this.androidHasGesture, @Deprecated('Use hasGesture instead') this.androidHasGesture,
@ -87,94 +133,5 @@ class NavigationAction {
this.sourceFrame, this.sourceFrame,
@Deprecated("Use targetFrame instead") this.iosTargetFrame, @Deprecated("Use targetFrame instead") this.iosTargetFrame,
this.targetFrame, this.targetFrame,
this.shouldPerformDownload}) { this.shouldPerformDownload});
// ignore: deprecated_member_use_from_same_package
this.hasGesture = this.hasGesture ?? this.androidHasGesture;
// ignore: deprecated_member_use_from_same_package
this.isRedirect = this.isRedirect ?? this.androidIsRedirect;
this.navigationType = this.navigationType ??
// ignore: deprecated_member_use_from_same_package
NavigationType.fromValue(this.iosWKNavigationType?.toValue());
this.sourceFrame =
// ignore: deprecated_member_use_from_same_package
this.sourceFrame ?? FrameInfo.fromMap(this.iosSourceFrame?.toMap());
this.targetFrame =
// ignore: deprecated_member_use_from_same_package
this.targetFrame ?? FrameInfo.fromMap(this.iosTargetFrame?.toMap());
}
///Gets a possible [NavigationAction] instance from a [Map] value.
static NavigationAction? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return NavigationAction(
request: URLRequest.fromMap(map["request"].cast<String, dynamic>())!,
isForMainFrame: map["isForMainFrame"],
// ignore: deprecated_member_use_from_same_package
androidHasGesture: map["hasGesture"] ?? map["androidHasGesture"],
hasGesture: map["hasGesture"],
// ignore: deprecated_member_use_from_same_package
androidIsRedirect: map["isRedirect"] ?? map["androidIsRedirect"],
isRedirect: map["isRedirect"],
// ignore: deprecated_member_use_from_same_package
iosWKNavigationType:
// ignore: deprecated_member_use_from_same_package
IOSWKNavigationType.fromValue(map["navigationType"]),
navigationType: NavigationType.fromValue(map["navigationType"]),
// ignore: deprecated_member_use_from_same_package
iosSourceFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
sourceFrame:
FrameInfo.fromMap(map["sourceFrame"]?.cast<String, dynamic>()),
// ignore: deprecated_member_use_from_same_package
iosTargetFrame:
// ignore: deprecated_member_use_from_same_package
IOSWKFrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
targetFrame:
FrameInfo.fromMap(map["targetFrame"]?.cast<String, dynamic>()),
shouldPerformDownload: map["shouldPerformDownload"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"request": request.toMap(),
"isForMainFrame": isForMainFrame,
// ignore: deprecated_member_use_from_same_package
"androidHasGesture": hasGesture ?? androidHasGesture,
// ignore: deprecated_member_use_from_same_package
"hasGesture": hasGesture ?? androidHasGesture,
// ignore: deprecated_member_use_from_same_package
"isRedirect": isRedirect ?? androidIsRedirect,
// ignore: deprecated_member_use_from_same_package
"androidIsRedirect": isRedirect ?? androidIsRedirect,
"iosWKNavigationType":
// ignore: deprecated_member_use_from_same_package
navigationType?.toValue() ?? iosWKNavigationType?.toValue(),
"navigationType":
// ignore: deprecated_member_use_from_same_package
navigationType?.toValue() ?? iosWKNavigationType?.toValue(),
// ignore: deprecated_member_use_from_same_package
"iosSourceFrame": sourceFrame?.toMap() ?? iosSourceFrame?.toMap(),
// ignore: deprecated_member_use_from_same_package
"sourceFrame": sourceFrame?.toMap() ?? iosSourceFrame?.toMap(),
// ignore: deprecated_member_use_from_same_package
"iosTargetFrame": targetFrame?.toMap() ?? iosTargetFrame?.toMap(),
// ignore: deprecated_member_use_from_same_package
"targetFrame": targetFrame?.toMap() ?? iosTargetFrame?.toMap(),
"shouldPerformDownload": shouldPerformDownload
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,162 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'navigation_action.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///An object that contains information about an action that causes navigation to occur.
class NavigationAction {
///The URL request object associated with the navigation action.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event
///and the window has been created using JavaScript, [request.url] will be `null`,
///the [request.method] is always `GET`, and [request.headers] value is always `null`.
///Also, on Android < 21, the [request.method] is always `GET` and [request.headers] value is always `null`.
URLRequest request;
///Indicates whether the request was made for the main frame.
///
///**NOTE for Android**: If the request is associated to the [WebView.onCreateWindow] event, this is always `true`.
///Also, on Android < 21, this is always `true`.
bool isForMainFrame;
///Use [hasGesture] instead.
@Deprecated('Use hasGesture instead')
bool? androidHasGesture;
///Gets whether a gesture (such as a click) was associated with the request.
///For security reasons in certain situations this method may return `false` even though
///the sequence of events which caused the request to be created was initiated by a user
///gesture.
///
///**NOTE for Android native WebView**: On Android < 21, this is always `false`
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - WebResourceRequest.hasGesture](https://developer.android.com/reference/android/webkit/WebResourceRequest#hasGesture()))
bool? hasGesture;
///Use [isRedirect] instead.
@Deprecated('Use isRedirect instead')
bool? androidIsRedirect;
///Gets whether the request was a result of a server-side redirect.
///
///**NOTE**: If the request is associated to the [WebView.onCreateWindow] event, this is always `false`.
///Also, on Android < 21, this is always `false`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - WebResourceRequest.isRedirect](https://developer.android.com/reference/android/webkit/WebResourceRequest#isRedirect()))
bool? isRedirect;
///Use [navigationType] instead.
@Deprecated('Use navigationType instead')
IOSWKNavigationType? iosWKNavigationType;
///The type of action triggering the navigation.ì
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.navigationType](https://developer.apple.com/documentation/webkit/wknavigationaction/1401914-navigationtype))
NavigationType? navigationType;
///Use [sourceFrame] instead.
@Deprecated('Use sourceFrame instead')
IOSWKFrameInfo? iosSourceFrame;
///The frame that requested the navigation.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.sourceFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401926-sourceframe))
FrameInfo? sourceFrame;
///Use [targetFrame] instead.
@Deprecated('Use targetFrame instead')
IOSWKFrameInfo? iosTargetFrame;
///The frame in which to display the new content.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - WKNavigationAction.targetFrame](https://developer.apple.com/documentation/webkit/wknavigationaction/1401918-targetframe))
FrameInfo? targetFrame;
///A value indicating whether the web content used a download attribute to indicate that this should be downloaded.
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - WKNavigationAction.shouldPerformDownload](https://developer.apple.com/documentation/webkit/wknavigationaction/3727357-shouldperformdownload))
bool? shouldPerformDownload;
NavigationAction(
{required this.request,
required this.isForMainFrame,
@Deprecated('Use hasGesture instead') this.androidHasGesture,
this.hasGesture,
@Deprecated('Use isRedirect instead') this.androidIsRedirect,
this.isRedirect,
@Deprecated('Use navigationType instead') this.iosWKNavigationType,
this.navigationType,
@Deprecated('Use sourceFrame instead') this.iosSourceFrame,
this.sourceFrame,
@Deprecated('Use targetFrame instead') this.iosTargetFrame,
this.targetFrame,
this.shouldPerformDownload}) {
hasGesture = hasGesture ?? androidHasGesture;
isRedirect = isRedirect ?? androidIsRedirect;
navigationType = navigationType ??
NavigationType.fromNativeValue(iosWKNavigationType?.toNativeValue());
sourceFrame = sourceFrame ?? FrameInfo.fromMap(iosSourceFrame?.toMap());
targetFrame = targetFrame ?? FrameInfo.fromMap(iosTargetFrame?.toMap());
}
///Gets a possible [NavigationAction] instance from a [Map] value.
static NavigationAction? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = NavigationAction(
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
isForMainFrame: map['isForMainFrame'],
);
instance.androidHasGesture = map['hasGesture'];
instance.hasGesture = map['hasGesture'];
instance.androidIsRedirect = map['isRedirect'];
instance.isRedirect = map['isRedirect'];
instance.iosWKNavigationType =
IOSWKNavigationType.fromNativeValue(map['navigationType']);
instance.navigationType =
NavigationType.fromNativeValue(map['navigationType']);
instance.iosSourceFrame =
IOSWKFrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>());
instance.sourceFrame =
FrameInfo.fromMap(map['sourceFrame']?.cast<String, dynamic>());
instance.iosTargetFrame =
IOSWKFrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>());
instance.targetFrame =
FrameInfo.fromMap(map['targetFrame']?.cast<String, dynamic>());
instance.shouldPerformDownload = map['shouldPerformDownload'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"request": request.toMap(),
"isForMainFrame": isForMainFrame,
"hasGesture": hasGesture,
"isRedirect": isRedirect,
"navigationType": navigationType?.toNativeValue(),
"sourceFrame": sourceFrame?.toMap(),
"targetFrame": targetFrame?.toMap(),
"shouldPerformDownload": shouldPerformDownload,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'NavigationAction{request: $request, isForMainFrame: $isForMainFrame, hasGesture: $hasGesture, isRedirect: $isRedirect, navigationType: $navigationType, sourceFrame: $sourceFrame, targetFrame: $targetFrame, shouldPerformDownload: $shouldPerformDownload}';
}
}

View File

@ -1,153 +1,59 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
part 'navigation_type.g.dart';
///Class that represents the type of action triggering a navigation for the [WebView.shouldOverrideUrlLoading] event. ///Class that represents the type of action triggering a navigation for the [WebView.shouldOverrideUrlLoading] event.
class NavigationType { @ExchangeableEnum()
class NavigationType_ {
// ignore: unused_field
final int _value; final int _value;
const NavigationType_._internal(this._value);
const NavigationType._internal(this._value);
///Set of all values of [NavigationType].
static final Set<NavigationType> values = [
NavigationType.LINK_ACTIVATED,
NavigationType.FORM_SUBMITTED,
NavigationType.BACK_FORWARD,
NavigationType.RELOAD,
NavigationType.FORM_RESUBMITTED,
NavigationType.OTHER,
].toSet();
///Gets a possible [NavigationType] instance from an [int] value.
static NavigationType? fromValue(int? value) {
if (value != null) {
try {
return NavigationType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///A link with an href attribute was activated by the user. ///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = const NavigationType._internal(0); static const LINK_ACTIVATED = const NavigationType_._internal(0);
///A form was submitted. ///A form was submitted.
static const FORM_SUBMITTED = const NavigationType._internal(1); static const FORM_SUBMITTED = const NavigationType_._internal(1);
///An item from the back-forward list was requested. ///An item from the back-forward list was requested.
static const BACK_FORWARD = const NavigationType._internal(2); static const BACK_FORWARD = const NavigationType_._internal(2);
///The webpage was reloaded. ///The webpage was reloaded.
static const RELOAD = const NavigationType._internal(3); static const RELOAD = const NavigationType_._internal(3);
///A form was resubmitted (for example by going back, going forward, or reloading). ///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = const NavigationType._internal(4); static const FORM_RESUBMITTED = const NavigationType_._internal(4);
///Navigation is taking place for some other reason. ///Navigation is taking place for some other reason.
static const OTHER = const NavigationType._internal(-1); static const OTHER = const NavigationType_._internal(-1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
@override
String toString() {
switch (_value) {
case 0:
return "LINK_ACTIVATED";
case 1:
return "FORM_SUBMITTED";
case 2:
return "BACK_FORWARD";
case 3:
return "RELOAD";
case 4:
return "FORM_RESUBMITTED";
case -1:
default:
return "OTHER";
}
}
} }
///Class that represents the type of action triggering a navigation on iOS for the [WebView.shouldOverrideUrlLoading] event. ///Class that represents the type of action triggering a navigation on iOS for the [WebView.shouldOverrideUrlLoading] event.
///Use [NavigationType] instead. ///Use [NavigationType] instead.
@Deprecated("Use NavigationType instead") @Deprecated("Use NavigationType instead")
class IOSWKNavigationType { @ExchangeableEnum()
class IOSWKNavigationType_ {
// ignore: unused_field
final int _value; final int _value;
const IOSWKNavigationType_._internal(this._value);
const IOSWKNavigationType._internal(this._value);
///Set of all values of [IOSWKNavigationType].
static final Set<IOSWKNavigationType> values = [
IOSWKNavigationType.LINK_ACTIVATED,
IOSWKNavigationType.FORM_SUBMITTED,
IOSWKNavigationType.BACK_FORWARD,
IOSWKNavigationType.RELOAD,
IOSWKNavigationType.FORM_RESUBMITTED,
IOSWKNavigationType.OTHER,
].toSet();
///Gets a possible [IOSWKNavigationType] instance from an [int] value.
static IOSWKNavigationType? fromValue(int? value) {
if (value != null) {
try {
return IOSWKNavigationType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///A link with an href attribute was activated by the user. ///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = const IOSWKNavigationType._internal(0); static const LINK_ACTIVATED = const IOSWKNavigationType_._internal(0);
///A form was submitted. ///A form was submitted.
static const FORM_SUBMITTED = const IOSWKNavigationType._internal(1); static const FORM_SUBMITTED = const IOSWKNavigationType_._internal(1);
///An item from the back-forward list was requested. ///An item from the back-forward list was requested.
static const BACK_FORWARD = const IOSWKNavigationType._internal(2); static const BACK_FORWARD = const IOSWKNavigationType_._internal(2);
///The webpage was reloaded. ///The webpage was reloaded.
static const RELOAD = const IOSWKNavigationType._internal(3); static const RELOAD = const IOSWKNavigationType_._internal(3);
///A form was resubmitted (for example by going back, going forward, or reloading). ///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = const IOSWKNavigationType._internal(4); static const FORM_RESUBMITTED = const IOSWKNavigationType_._internal(4);
///Navigation is taking place for some other reason. ///Navigation is taking place for some other reason.
static const OTHER = const IOSWKNavigationType._internal(-1); static const OTHER = const IOSWKNavigationType_._internal(-1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
@override
String toString() {
switch (_value) {
case 0:
return "LINK_ACTIVATED";
case 1:
return "FORM_SUBMITTED";
case 2:
return "BACK_FORWARD";
case 3:
return "RELOAD";
case 4:
return "FORM_RESUBMITTED";
case -1:
default:
return "OTHER";
}
}
} }

View File

@ -0,0 +1,201 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'navigation_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the type of action triggering a navigation for the [WebView.shouldOverrideUrlLoading] event.
class NavigationType {
final int _value;
final int _nativeValue;
const NavigationType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory NavigationType._internalMultiPlatform(
int value, Function nativeValue) =>
NavigationType._internal(value, nativeValue());
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = NavigationType._internal(0, 0);
///A form was submitted.
static const FORM_SUBMITTED = NavigationType._internal(1, 1);
///An item from the back-forward list was requested.
static const BACK_FORWARD = NavigationType._internal(2, 2);
///The webpage was reloaded.
static const RELOAD = NavigationType._internal(3, 3);
///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = NavigationType._internal(4, 4);
///Navigation is taking place for some other reason.
static const OTHER = NavigationType._internal(-1, -1);
///Set of all values of [NavigationType].
static final Set<NavigationType> values = [
NavigationType.LINK_ACTIVATED,
NavigationType.FORM_SUBMITTED,
NavigationType.BACK_FORWARD,
NavigationType.RELOAD,
NavigationType.FORM_RESUBMITTED,
NavigationType.OTHER,
].toSet();
///Gets a possible [NavigationType] instance from [int] value.
static NavigationType? fromValue(int? value) {
if (value != null) {
try {
return NavigationType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [NavigationType] instance from a native value.
static NavigationType? fromNativeValue(int? value) {
if (value != null) {
try {
return NavigationType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'LINK_ACTIVATED';
case 1:
return 'FORM_SUBMITTED';
case 2:
return 'BACK_FORWARD';
case 3:
return 'RELOAD';
case 4:
return 'FORM_RESUBMITTED';
case -1:
return 'OTHER';
}
return _value.toString();
}
}
///Class that represents the type of action triggering a navigation on iOS for the [WebView.shouldOverrideUrlLoading] event.
///Use [NavigationType] instead.
@Deprecated('Use NavigationType instead')
class IOSWKNavigationType {
final int _value;
final int _nativeValue;
const IOSWKNavigationType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSWKNavigationType._internalMultiPlatform(
int value, Function nativeValue) =>
IOSWKNavigationType._internal(value, nativeValue());
///A link with an href attribute was activated by the user.
static const LINK_ACTIVATED = IOSWKNavigationType._internal(0, 0);
///A form was submitted.
static const FORM_SUBMITTED = IOSWKNavigationType._internal(1, 1);
///An item from the back-forward list was requested.
static const BACK_FORWARD = IOSWKNavigationType._internal(2, 2);
///The webpage was reloaded.
static const RELOAD = IOSWKNavigationType._internal(3, 3);
///A form was resubmitted (for example by going back, going forward, or reloading).
static const FORM_RESUBMITTED = IOSWKNavigationType._internal(4, 4);
///Navigation is taking place for some other reason.
static const OTHER = IOSWKNavigationType._internal(-1, -1);
///Set of all values of [IOSWKNavigationType].
static final Set<IOSWKNavigationType> values = [
IOSWKNavigationType.LINK_ACTIVATED,
IOSWKNavigationType.FORM_SUBMITTED,
IOSWKNavigationType.BACK_FORWARD,
IOSWKNavigationType.RELOAD,
IOSWKNavigationType.FORM_RESUBMITTED,
IOSWKNavigationType.OTHER,
].toSet();
///Gets a possible [IOSWKNavigationType] instance from [int] value.
static IOSWKNavigationType? fromValue(int? value) {
if (value != null) {
try {
return IOSWKNavigationType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSWKNavigationType] instance from a native value.
static IOSWKNavigationType? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSWKNavigationType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'LINK_ACTIVATED';
case 1:
return 'FORM_SUBMITTED';
case 2:
return 'BACK_FORWARD';
case 3:
return 'RELOAD';
case 4:
return 'FORM_RESUBMITTED';
case -1:
return 'OTHER';
}
return _value.toString();
}
}

View File

@ -48,15 +48,19 @@ class URLProtectionSpace_ {
SslCertificate_? sslCertificate; SslCertificate_? sslCertificate;
///The SSL Error associated. ///The SSL Error associated.
SslError? sslError; SslError_? sslError;
///Use [authenticationMethod] instead. ///Use [authenticationMethod] instead.
@Deprecated("Use authenticationMethod instead") @Deprecated("Use authenticationMethod instead")
IOSNSURLProtectionSpaceAuthenticationMethod_? iosAuthenticationMethod; IOSNSURLProtectionSpaceAuthenticationMethod_? iosAuthenticationMethod;
///The authentication method used by the receiver. ///The authentication method used by the receiver.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLProtectionSpace.authenticationMethod",
apiUrl: "https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod"
)
])
URLProtectionSpaceAuthenticationMethod_? authenticationMethod; URLProtectionSpaceAuthenticationMethod_? authenticationMethod;
///Use [distinguishedNames] instead. ///Use [distinguishedNames] instead.
@ -69,11 +73,15 @@ class URLProtectionSpace_ {
///The acceptable certificate-issuing authorities for client certificate authentication. ///The acceptable certificate-issuing authorities for client certificate authentication.
///This value is `null` if the authentication method of the protection space is not client certificate. ///This value is `null` if the authentication method of the protection space is not client certificate.
///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER). ///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER).
///
///**NOTE**: available only on iOS.
@ExchangeableObjectProperty( @ExchangeableObjectProperty(
deserializer: _distinguishedNamesDeserializer deserializer: _distinguishedNamesDeserializer
) )
@SupportedPlatforms(platforms: [
IOSPlatform(
apiName: "URLProtectionSpace.distinguishedNames",
apiUrl: "https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames"
)
])
List<X509Certificate>? distinguishedNames; List<X509Certificate>? distinguishedNames;
///Use [receivesCredentialSecurely] instead. ///Use [receivesCredentialSecurely] instead.
@ -82,29 +90,28 @@ class URLProtectionSpace_ {
///A Boolean value that indicates whether the credentials for the protection space can be sent securely. ///A Boolean value that indicates whether the credentials for the protection space can be sent securely.
///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise. ///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLProtectionSpace.receivesCredentialSecurely",
apiUrl: "https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely"
)
])
bool? receivesCredentialSecurely; bool? receivesCredentialSecurely;
///Use [isProxy] instead.
@Deprecated("Use isProxy instead")
bool? iosIsProxy;
///Returns a Boolean value that indicates whether the receiver does not descend from `NSObject`.
///
///**NOTE**: available only on iOS.
bool? isProxy;
///Use [proxyType] instead. ///Use [proxyType] instead.
@Deprecated("Use proxyType instead") @Deprecated("Use proxyType instead")
IOSNSURLProtectionSpaceProxyType? iosProxyType; IOSNSURLProtectionSpaceProxyType_? iosProxyType;
///The receiver's proxy type. ///The receiver's proxy type.
///This value is `null` if the receiver does not represent a proxy protection space. ///This value is `null` if the receiver does not represent a proxy protection space.
///The supported proxy types are listed in [URLProtectionSpaceProxyType.values]. ///The supported proxy types are listed in [URLProtectionSpaceProxyType.values].
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
URLProtectionSpaceProxyType? proxyType; apiName: "URLProtectionSpace.proxyType",
apiUrl: "https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype"
)
])
URLProtectionSpaceProxyType_? proxyType;
URLProtectionSpace_( URLProtectionSpace_(
{required this.host, {required this.host,
@ -122,9 +129,6 @@ class URLProtectionSpace_ {
@Deprecated("Use receivesCredentialSecurely instead") @Deprecated("Use receivesCredentialSecurely instead")
this.iosReceivesCredentialSecurely, this.iosReceivesCredentialSecurely,
this.receivesCredentialSecurely, this.receivesCredentialSecurely,
@Deprecated("Use isProxy instead")
this.iosIsProxy,
this.isProxy,
@Deprecated("Use proxyType instead") @Deprecated("Use proxyType instead")
this.iosProxyType, this.iosProxyType,
this.proxyType}); this.proxyType});

View File

@ -26,7 +26,7 @@ class URLProtectionSpace {
SslCertificate? sslCertificate; SslCertificate? sslCertificate;
///The SSL Error associated. ///The SSL Error associated.
SslError? sslError; dynamic sslError;
///Use [authenticationMethod] instead. ///Use [authenticationMethod] instead.
@Deprecated('Use authenticationMethod instead') @Deprecated('Use authenticationMethod instead')
@ -34,7 +34,8 @@ class URLProtectionSpace {
///The authentication method used by the receiver. ///The authentication method used by the receiver.
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.authenticationMethod](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415028-authenticationmethod))
URLProtectionSpaceAuthenticationMethod? authenticationMethod; URLProtectionSpaceAuthenticationMethod? authenticationMethod;
///Use [distinguishedNames] instead. ///Use [distinguishedNames] instead.
@ -45,7 +46,8 @@ class URLProtectionSpace {
///This value is `null` if the authentication method of the protection space is not client certificate. ///This value is `null` if the authentication method of the protection space is not client certificate.
///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER). ///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER).
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.distinguishedNames](https://developer.apple.com/documentation/foundation/urlprotectionspace/1417061-distinguishednames))
List<X509Certificate>? distinguishedNames; List<X509Certificate>? distinguishedNames;
///Use [receivesCredentialSecurely] instead. ///Use [receivesCredentialSecurely] instead.
@ -55,28 +57,21 @@ class URLProtectionSpace {
///A Boolean value that indicates whether the credentials for the protection space can be sent securely. ///A Boolean value that indicates whether the credentials for the protection space can be sent securely.
///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise. ///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise.
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLProtectionSpace.receivesCredentialSecurely](https://developer.apple.com/documentation/foundation/urlprotectionspace/1415176-receivescredentialsecurely))
bool? receivesCredentialSecurely; bool? receivesCredentialSecurely;
///Use [isProxy] instead.
@Deprecated('Use isProxy instead')
bool? iosIsProxy;
///Returns a Boolean value that indicates whether the receiver does not descend from `NSObject`.
///
///**NOTE**: available only on iOS.
bool? isProxy;
///Use [proxyType] instead. ///Use [proxyType] instead.
@Deprecated('Use proxyType instead') @Deprecated('Use proxyType instead')
IOSNSURLProtectionSpaceProxyType? iosProxyType; dynamic iosProxyType;
///The receiver's proxy type. ///The receiver's proxy type.
///This value is `null` if the receiver does not represent a proxy protection space. ///This value is `null` if the receiver does not represent a proxy protection space.
///The supported proxy types are listed in [URLProtectionSpaceProxyType.values]. ///The supported proxy types are listed in [URLProtectionSpaceProxyType.values].
/// ///
///**NOTE**: available only on iOS. ///**Supported Platforms/Implementations**:
URLProtectionSpaceProxyType? proxyType; ///- iOS ([Official API - URLProtectionSpace.proxyType](https://developer.apple.com/documentation/foundation/urlprotectionspace/1411924-proxytype))
dynamic proxyType;
URLProtectionSpace( URLProtectionSpace(
{required this.host, {required this.host,
this.protocol, this.protocol,
@ -93,9 +88,6 @@ class URLProtectionSpace {
@Deprecated('Use receivesCredentialSecurely instead') @Deprecated('Use receivesCredentialSecurely instead')
this.iosReceivesCredentialSecurely, this.iosReceivesCredentialSecurely,
this.receivesCredentialSecurely, this.receivesCredentialSecurely,
@Deprecated('Use isProxy instead')
this.iosIsProxy,
this.isProxy,
@Deprecated('Use proxyType instead') @Deprecated('Use proxyType instead')
this.iosProxyType, this.iosProxyType,
this.proxyType}) { this.proxyType}) {
@ -105,9 +97,7 @@ class URLProtectionSpace {
distinguishedNames = distinguishedNames ?? iosDistinguishedNames; distinguishedNames = distinguishedNames ?? iosDistinguishedNames;
receivesCredentialSecurely = receivesCredentialSecurely =
receivesCredentialSecurely ?? iosReceivesCredentialSecurely; receivesCredentialSecurely ?? iosReceivesCredentialSecurely;
isProxy = isProxy ?? iosIsProxy; proxyType = proxyType ?? iosProxyType;
proxyType = proxyType ??
URLProtectionSpaceProxyType.fromValue(iosProxyType?.toValue());
} }
///Gets a possible [URLProtectionSpace] instance from a [Map] value. ///Gets a possible [URLProtectionSpace] instance from a [Map] value.
@ -123,8 +113,7 @@ class URLProtectionSpace {
instance.port = map['port']; instance.port = map['port'];
instance.sslCertificate = instance.sslCertificate =
SslCertificate.fromMap(map['sslCertificate']?.cast<String, dynamic>()); SslCertificate.fromMap(map['sslCertificate']?.cast<String, dynamic>());
instance.sslError = instance.sslError = map['sslError'];
SslError.fromMap(map['sslError']?.cast<String, dynamic>());
instance.iosAuthenticationMethod = instance.iosAuthenticationMethod =
IOSNSURLProtectionSpaceAuthenticationMethod.fromNativeValue( IOSNSURLProtectionSpaceAuthenticationMethod.fromNativeValue(
map['authenticationMethod']); map['authenticationMethod']);
@ -137,12 +126,8 @@ class URLProtectionSpace {
_distinguishedNamesDeserializer(map['distinguishedNames']); _distinguishedNamesDeserializer(map['distinguishedNames']);
instance.iosReceivesCredentialSecurely = map['receivesCredentialSecurely']; instance.iosReceivesCredentialSecurely = map['receivesCredentialSecurely'];
instance.receivesCredentialSecurely = map['receivesCredentialSecurely']; instance.receivesCredentialSecurely = map['receivesCredentialSecurely'];
instance.iosIsProxy = map['isProxy']; instance.iosProxyType = map['proxyType'];
instance.isProxy = map['isProxy']; instance.proxyType = map['proxyType'];
instance.iosProxyType =
IOSNSURLProtectionSpaceProxyType.fromValue(map['proxyType']);
instance.proxyType =
URLProtectionSpaceProxyType.fromValue(map['proxyType']);
return instance; return instance;
} }
@ -154,12 +139,11 @@ class URLProtectionSpace {
"realm": realm, "realm": realm,
"port": port, "port": port,
"sslCertificate": sslCertificate?.toMap(), "sslCertificate": sslCertificate?.toMap(),
"sslError": sslError?.toMap(), "sslError": sslError,
"authenticationMethod": authenticationMethod?.toNativeValue(), "authenticationMethod": authenticationMethod?.toNativeValue(),
"distinguishedNames": distinguishedNames?.map((e) => e.toMap()).toList(), "distinguishedNames": distinguishedNames?.map((e) => e.toMap()).toList(),
"receivesCredentialSecurely": receivesCredentialSecurely, "receivesCredentialSecurely": receivesCredentialSecurely,
"isProxy": isProxy, "proxyType": proxyType,
"proxyType": proxyType?.toValue(),
}; };
} }
@ -170,6 +154,6 @@ class URLProtectionSpace {
@override @override
String toString() { String toString() {
return 'URLProtectionSpace{host: $host, protocol: $protocol, realm: $realm, port: $port, sslCertificate: $sslCertificate, sslError: $sslError, authenticationMethod: $authenticationMethod, distinguishedNames: $distinguishedNames, receivesCredentialSecurely: $receivesCredentialSecurely, isProxy: $isProxy, proxyType: $proxyType}'; return 'URLProtectionSpace{host: $host, protocol: $protocol, realm: $realm, port: $port, sslCertificate: $sslCertificate, sslError: $sslError, authenticationMethod: $authenticationMethod, distinguishedNames: $distinguishedNames, receivesCredentialSecurely: $receivesCredentialSecurely, proxyType: $proxyType}';
} }
} }

View File

@ -1,11 +1,15 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter_inappwebview/src/types/url_request_attribution.dart'; import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_request_cache_policy.dart'; import 'url_request_cache_policy.dart';
import 'url_request_network_service_type.dart'; import 'url_request_network_service_type.dart';
import 'url_request_attribution.dart';
part 'url_request.g.dart';
///A URL load request that is independent of protocol or URL scheme. ///A URL load request that is independent of protocol or URL scheme.
class URLRequest { @ExchangeableObject()
class URLRequest_ {
///The URL of the request. Setting this to `null` will load `about:blank`. ///The URL of the request. Setting this to `null` will load `about:blank`.
Uri? url; Uri? url;
@ -25,8 +29,12 @@ class URLRequest {
bool? iosAllowsCellularAccess; bool? iosAllowsCellularAccess;
///A Boolean value indicating whether the request is allowed to use the built-in cellular radios to satisfy the request. ///A Boolean value indicating whether the request is allowed to use the built-in cellular radios to satisfy the request.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLRequest.allowsCellularAccess",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/"
)
])
bool? allowsCellularAccess; bool? allowsCellularAccess;
///Use [allowsConstrainedNetworkAccess] instead. ///Use [allowsConstrainedNetworkAccess] instead.
@ -34,8 +42,13 @@ class URLRequest {
bool? iosAllowsConstrainedNetworkAccess; bool? iosAllowsConstrainedNetworkAccess;
///A Boolean value that indicates whether the request may use the network when the user has specified Low Data Mode. ///A Boolean value that indicates whether the request may use the network when the user has specified Low Data Mode.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS 13.0+. IOSPlatform(
available: "13.0",
apiName: "URLRequest.allowsConstrainedNetworkAccess",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess"
)
])
bool? allowsConstrainedNetworkAccess; bool? allowsConstrainedNetworkAccess;
///Use [allowsExpensiveNetworkAccess] instead. ///Use [allowsExpensiveNetworkAccess] instead.
@ -43,26 +56,39 @@ class URLRequest {
bool? iosAllowsExpensiveNetworkAccess; bool? iosAllowsExpensiveNetworkAccess;
///A Boolean value that indicates whether connections may use a network interface that the system considers expensive. ///A Boolean value that indicates whether connections may use a network interface that the system considers expensive.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS 13.0+. IOSPlatform(
available: "13.0",
apiName: "URLRequest.allowsExpensiveNetworkAccess",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess"
)
])
bool? allowsExpensiveNetworkAccess; bool? allowsExpensiveNetworkAccess;
///Use [cachePolicy] instead. ///Use [cachePolicy] instead.
@Deprecated("Use cachePolicy instead") @Deprecated("Use cachePolicy instead")
IOSURLRequestCachePolicy? iosCachePolicy; IOSURLRequestCachePolicy_? iosCachePolicy;
///The requests cache policy. ///The requests cache policy.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
URLRequestCachePolicy? cachePolicy; apiName: "URLRequest.cachePolicy",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy"
)
])
URLRequestCachePolicy_? cachePolicy;
///Use [httpShouldHandleCookies] instead. ///Use [httpShouldHandleCookies] instead.
@Deprecated("Use httpShouldHandleCookies instead") @Deprecated("Use httpShouldHandleCookies instead")
bool? iosHttpShouldHandleCookies; bool? iosHttpShouldHandleCookies;
///A Boolean value indicating whether cookies will be sent with and set for this request. ///A Boolean value indicating whether cookies will be sent with and set for this request.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLRequest.httpShouldHandleCookies",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies"
)
])
bool? httpShouldHandleCookies; bool? httpShouldHandleCookies;
///Use [httpShouldUsePipelining] instead. ///Use [httpShouldUsePipelining] instead.
@ -70,26 +96,38 @@ class URLRequest {
bool? iosHttpShouldUsePipelining; bool? iosHttpShouldUsePipelining;
///A Boolean value indicating whether the request should transmit before the previous response is received. ///A Boolean value indicating whether the request should transmit before the previous response is received.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLRequest.httpShouldUsePipelining",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining"
)
])
bool? httpShouldUsePipelining; bool? httpShouldUsePipelining;
///Use [networkServiceType] instead. ///Use [networkServiceType] instead.
@Deprecated("Use networkServiceType instead") @Deprecated("Use networkServiceType instead")
IOSURLRequestNetworkServiceType? iosNetworkServiceType; IOSURLRequestNetworkServiceType_? iosNetworkServiceType;
///The service type associated with this request. ///The service type associated with this request.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
URLRequestNetworkServiceType? networkServiceType; apiName: "URLRequest.networkServiceType",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype"
)
])
URLRequestNetworkServiceType_? networkServiceType;
///Use [timeoutInterval] instead. ///Use [timeoutInterval] instead.
@Deprecated("Use timeoutInterval instead") @Deprecated("Use timeoutInterval instead")
double? iosTimeoutInterval; double? iosTimeoutInterval;
///The timeout interval of the request. ///The timeout interval of the request.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLRequest.timeoutInterval",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval"
)
])
double? timeoutInterval; double? timeoutInterval;
///Use [mainDocumentURL] instead. ///Use [mainDocumentURL] instead.
@ -98,25 +136,39 @@ class URLRequest {
///The main document URL associated with this request. ///The main document URL associated with this request.
///This URL is used for the cookie same domain as main document policy. ///This URL is used for the cookie same domain as main document policy.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS. IOSPlatform(
apiName: "URLRequest.mainDocumentURL",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl"
)
])
Uri? mainDocumentURL; Uri? mainDocumentURL;
///`true` if server endpoint is known to support HTTP/3. Enables QUIC racing ///`true` if server endpoint is known to support HTTP/3. Enables QUIC racing
///without HTTP/3 service discovery. Defaults to `false`. ///without HTTP/3 service discovery. Defaults to `false`.
///The default may be `true` in a future OS update. ///The default may be `true` in a future OS update.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS 14.5+. IOSPlatform(
available: "14.5",
apiName: "URLRequest.assumesHTTP3Capable",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable"
)
])
bool? assumesHTTP3Capable; bool? assumesHTTP3Capable;
///The entities that can make a network request. ///The entities that can make a network request.
/// ///
///If you dont set a value, the system assumes [URLRequestAttribution.DEVELOPER]. ///If you dont set a value, the system assumes [URLRequestAttribution.DEVELOPER].
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on iOS 15.0+. IOSPlatform(
URLRequestAttribution? attribution; available: "15.0",
apiName: "URLRequest.attribution",
apiUrl: "https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution"
)
])
URLRequestAttribution_? attribution;
URLRequest({ URLRequest_({
required this.url, required this.url,
this.method, this.method,
this.headers, this.headers,
@ -146,150 +198,5 @@ class URLRequest {
this.mainDocumentURL, this.mainDocumentURL,
this.assumesHTTP3Capable, this.assumesHTTP3Capable,
this.attribution this.attribution
}) { });
this.allowsCellularAccess =
// ignore: deprecated_member_use_from_same_package
this.allowsCellularAccess ?? this.iosAllowsCellularAccess;
this.allowsConstrainedNetworkAccess = this.allowsConstrainedNetworkAccess ??
// ignore: deprecated_member_use_from_same_package
this.iosAllowsConstrainedNetworkAccess;
this.allowsExpensiveNetworkAccess = this.allowsExpensiveNetworkAccess ??
// ignore: deprecated_member_use_from_same_package
this.iosAllowsExpensiveNetworkAccess;
this.cachePolicy = this.cachePolicy ??
// ignore: deprecated_member_use_from_same_package
URLRequestCachePolicy.fromValue(this.iosCachePolicy?.toValue());
this.httpShouldHandleCookies =
// ignore: deprecated_member_use_from_same_package
this.httpShouldHandleCookies ?? this.iosHttpShouldHandleCookies;
this.httpShouldUsePipelining =
// ignore: deprecated_member_use_from_same_package
this.httpShouldUsePipelining ?? this.iosHttpShouldUsePipelining;
this.networkServiceType =
this.networkServiceType ?? URLRequestNetworkServiceType.fromValue(
// ignore: deprecated_member_use_from_same_package
this.iosNetworkServiceType?.toValue());
// ignore: deprecated_member_use_from_same_package
this.timeoutInterval = this.timeoutInterval ?? this.iosTimeoutInterval;
// ignore: deprecated_member_use_from_same_package
this.mainDocumentURL = this.mainDocumentURL ?? this.iosMainDocumentURL;
}
///Gets a possible [URLRequest] instance from a [Map] value.
static URLRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return URLRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
headers: map["headers"]?.cast<String, String>(),
method: map["method"],
body: map["body"],
// ignore: deprecated_member_use_from_same_package
iosAllowsCellularAccess: map["allowsCellularAccess"],
allowsCellularAccess: map["allowsCellularAccess"],
// ignore: deprecated_member_use_from_same_package
iosAllowsConstrainedNetworkAccess: map["allowsConstrainedNetworkAccess"],
allowsConstrainedNetworkAccess: map["allowsConstrainedNetworkAccess"],
// ignore: deprecated_member_use_from_same_package
iosAllowsExpensiveNetworkAccess: map["allowsExpensiveNetworkAccess"],
allowsExpensiveNetworkAccess: map["allowsExpensiveNetworkAccess"],
// ignore: deprecated_member_use_from_same_package
iosCachePolicy: IOSURLRequestCachePolicy.fromValue(map["cachePolicy"]),
cachePolicy: URLRequestCachePolicy.fromValue(map["cachePolicy"]),
// ignore: deprecated_member_use_from_same_package
iosHttpShouldHandleCookies: map["httpShouldHandleCookies"],
httpShouldHandleCookies: map["httpShouldHandleCookies"],
// ignore: deprecated_member_use_from_same_package
iosHttpShouldUsePipelining: map["httpShouldUsePipelining"],
httpShouldUsePipelining: map["httpShouldUsePipelining"],
// ignore: deprecated_member_use_from_same_package
iosNetworkServiceType:
// ignore: deprecated_member_use_from_same_package
IOSURLRequestNetworkServiceType.fromValue(map["networkServiceType"]),
networkServiceType:
URLRequestNetworkServiceType.fromValue(map["networkServiceType"]),
// ignore: deprecated_member_use_from_same_package
iosTimeoutInterval: map["timeoutInterval"],
timeoutInterval: map["timeoutInterval"],
// ignore: deprecated_member_use_from_same_package
iosMainDocumentURL: map["mainDocumentURL"] != null
? Uri.parse(map["mainDocumentURL"])
: null,
mainDocumentURL: map["mainDocumentURL"] != null
? Uri.parse(map["mainDocumentURL"])
: null,
assumesHTTP3Capable: map["assumesHTTP3Capable"],
attribution: URLRequestAttribution.fromValue(map["attribution"])
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"headers": headers,
"method": method,
"body": body,
"iosAllowsCellularAccess":
// ignore: deprecated_member_use_from_same_package
allowsCellularAccess ?? iosAllowsCellularAccess,
// ignore: deprecated_member_use_from_same_package
"allowsCellularAccess": allowsCellularAccess ?? iosAllowsCellularAccess,
"iosAllowsConstrainedNetworkAccess":
// ignore: deprecated_member_use_from_same_package
allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess,
"allowsConstrainedNetworkAccess":
// ignore: deprecated_member_use_from_same_package
allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess,
"iosAllowsExpensiveNetworkAccess":
// ignore: deprecated_member_use_from_same_package
allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess,
"allowsExpensiveNetworkAccess":
// ignore: deprecated_member_use_from_same_package
allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess,
// ignore: deprecated_member_use_from_same_package
"iosCachePolicy": cachePolicy?.toValue() ?? iosCachePolicy?.toValue(),
// ignore: deprecated_member_use_from_same_package
"cachePolicy": cachePolicy?.toValue() ?? iosCachePolicy?.toValue(),
"iosHttpShouldHandleCookies":
// ignore: deprecated_member_use_from_same_package
httpShouldHandleCookies ?? iosHttpShouldHandleCookies,
"httpShouldHandleCookies":
// ignore: deprecated_member_use_from_same_package
httpShouldHandleCookies ?? iosHttpShouldHandleCookies,
"iosHttpShouldUsePipelining":
// ignore: deprecated_member_use_from_same_package
httpShouldUsePipelining ?? iosHttpShouldUsePipelining,
"httpShouldUsePipelining":
// ignore: deprecated_member_use_from_same_package
httpShouldUsePipelining ?? iosHttpShouldUsePipelining,
"iosNetworkServiceType":
// ignore: deprecated_member_use_from_same_package
networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(),
"networkServiceType":
// ignore: deprecated_member_use_from_same_package
networkServiceType?.toValue() ?? iosNetworkServiceType?.toValue(),
// ignore: deprecated_member_use_from_same_package
"iosTimeoutInterval": timeoutInterval ?? iosTimeoutInterval,
// ignore: deprecated_member_use_from_same_package
"timeoutInterval": timeoutInterval ?? iosTimeoutInterval,
// ignore: deprecated_member_use_from_same_package
"iosMainDocumentURL": (mainDocumentURL ?? iosMainDocumentURL)?.toString(),
// ignore: deprecated_member_use_from_same_package
"mainDocumentURL": (mainDocumentURL ?? iosMainDocumentURL)?.toString(),
"assumesHTTP3Capable": assumesHTTP3Capable,
"attribution": attribution?.toValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,260 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///A URL load request that is independent of protocol or URL scheme.
class URLRequest {
///The URL of the request. Setting this to `null` will load `about:blank`.
Uri? url;
///The HTTP request method.
///
///**NOTE for Android**: it supports only "GET" and "POST" methods.
String? method;
///The data sent as the message body of a request, such as for an HTTP POST request.
Uint8List? body;
///A dictionary containing all of the HTTP header fields for a request.
Map<String, String>? headers;
///Use [allowsCellularAccess] instead.
@Deprecated('Use allowsCellularAccess instead')
bool? iosAllowsCellularAccess;
///A Boolean value indicating whether the request is allowed to use the built-in cellular radios to satisfy the request.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.allowsCellularAccess](https://developer.apple.com/documentation/foundation/urlrequest/2011607-allowscellularaccess/))
bool? allowsCellularAccess;
///Use [allowsConstrainedNetworkAccess] instead.
@Deprecated('Use allowsConstrainedNetworkAccess instead')
bool? iosAllowsConstrainedNetworkAccess;
///A Boolean value that indicates whether the request may use the network when the user has specified Low Data Mode.
///
///**Supported Platforms/Implementations**:
///- iOS 13.0+ ([Official API - URLRequest.allowsConstrainedNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358304-allowsconstrainednetworkaccess))
bool? allowsConstrainedNetworkAccess;
///Use [allowsExpensiveNetworkAccess] instead.
@Deprecated('Use allowsExpensiveNetworkAccess instead')
bool? iosAllowsExpensiveNetworkAccess;
///A Boolean value that indicates whether connections may use a network interface that the system considers expensive.
///
///**Supported Platforms/Implementations**:
///- iOS 13.0+ ([Official API - URLRequest.allowsExpensiveNetworkAccess](https://developer.apple.com/documentation/foundation/urlrequest/3358305-allowsexpensivenetworkaccess))
bool? allowsExpensiveNetworkAccess;
///Use [cachePolicy] instead.
@Deprecated('Use cachePolicy instead')
IOSURLRequestCachePolicy? iosCachePolicy;
///The requests cache policy.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.cachePolicy](https://developer.apple.com/documentation/foundation/urlrequest/2011593-cachepolicy))
URLRequestCachePolicy? cachePolicy;
///Use [httpShouldHandleCookies] instead.
@Deprecated('Use httpShouldHandleCookies instead')
bool? iosHttpShouldHandleCookies;
///A Boolean value indicating whether cookies will be sent with and set for this request.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.httpShouldHandleCookies](https://developer.apple.com/documentation/foundation/urlrequest/2011548-httpshouldhandlecookies))
bool? httpShouldHandleCookies;
///Use [httpShouldUsePipelining] instead.
@Deprecated('Use httpShouldUsePipelining instead')
bool? iosHttpShouldUsePipelining;
///A Boolean value indicating whether the request should transmit before the previous response is received.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.httpShouldUsePipelining](https://developer.apple.com/documentation/foundation/urlrequest/2011508-httpshouldusepipelining))
bool? httpShouldUsePipelining;
///Use [networkServiceType] instead.
@Deprecated('Use networkServiceType instead')
IOSURLRequestNetworkServiceType? iosNetworkServiceType;
///The service type associated with this request.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.networkServiceType](https://developer.apple.com/documentation/foundation/urlrequest/2011409-networkservicetype))
URLRequestNetworkServiceType? networkServiceType;
///Use [timeoutInterval] instead.
@Deprecated('Use timeoutInterval instead')
double? iosTimeoutInterval;
///The timeout interval of the request.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.timeoutInterval](https://developer.apple.com/documentation/foundation/urlrequest/2011509-timeoutinterval))
double? timeoutInterval;
///Use [mainDocumentURL] instead.
@Deprecated('Use mainDocumentURL instead')
Uri? iosMainDocumentURL;
///The main document URL associated with this request.
///This URL is used for the cookie same domain as main document policy.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - URLRequest.mainDocumentURL](https://developer.apple.com/documentation/foundation/urlrequest/2011552-maindocumenturl))
Uri? mainDocumentURL;
///`true` if server endpoint is known to support HTTP/3. Enables QUIC racing
///without HTTP/3 service discovery. Defaults to `false`.
///The default may be `true` in a future OS update.
///
///**Supported Platforms/Implementations**:
///- iOS 14.5+ ([Official API - URLRequest.assumesHTTP3Capable](https://developer.apple.com/documentation/foundation/urlrequest/3738175-assumeshttp3capable))
bool? assumesHTTP3Capable;
///The entities that can make a network request.
///
///If you dont set a value, the system assumes [URLRequestAttribution.DEVELOPER].
///
///**Supported Platforms/Implementations**:
///- iOS 15.0+ ([Official API - URLRequest.attribution](https://developer.apple.com/documentation/foundation/urlrequest/3767318-attribution))
URLRequestAttribution? attribution;
URLRequest(
{this.url,
this.method,
this.body,
this.headers,
@Deprecated('Use allowsCellularAccess instead')
this.iosAllowsCellularAccess,
this.allowsCellularAccess,
@Deprecated('Use allowsConstrainedNetworkAccess instead')
this.iosAllowsConstrainedNetworkAccess,
this.allowsConstrainedNetworkAccess,
@Deprecated('Use allowsExpensiveNetworkAccess instead')
this.iosAllowsExpensiveNetworkAccess,
this.allowsExpensiveNetworkAccess,
@Deprecated('Use cachePolicy instead')
this.iosCachePolicy,
this.cachePolicy,
@Deprecated('Use httpShouldHandleCookies instead')
this.iosHttpShouldHandleCookies,
this.httpShouldHandleCookies,
@Deprecated('Use httpShouldUsePipelining instead')
this.iosHttpShouldUsePipelining,
this.httpShouldUsePipelining,
@Deprecated('Use networkServiceType instead')
this.iosNetworkServiceType,
this.networkServiceType,
@Deprecated('Use timeoutInterval instead')
this.iosTimeoutInterval,
this.timeoutInterval,
@Deprecated('Use mainDocumentURL instead')
this.iosMainDocumentURL,
this.mainDocumentURL,
this.assumesHTTP3Capable,
this.attribution}) {
allowsCellularAccess = allowsCellularAccess ?? iosAllowsCellularAccess;
allowsConstrainedNetworkAccess =
allowsConstrainedNetworkAccess ?? iosAllowsConstrainedNetworkAccess;
allowsExpensiveNetworkAccess =
allowsExpensiveNetworkAccess ?? iosAllowsExpensiveNetworkAccess;
cachePolicy = cachePolicy ??
URLRequestCachePolicy.fromNativeValue(iosCachePolicy?.toNativeValue());
httpShouldHandleCookies =
httpShouldHandleCookies ?? iosHttpShouldHandleCookies;
httpShouldUsePipelining =
httpShouldUsePipelining ?? iosHttpShouldUsePipelining;
networkServiceType = networkServiceType ??
URLRequestNetworkServiceType.fromNativeValue(
iosNetworkServiceType?.toNativeValue());
timeoutInterval = timeoutInterval ?? iosTimeoutInterval;
mainDocumentURL = mainDocumentURL ?? iosMainDocumentURL;
}
///Gets a possible [URLRequest] instance from a [Map] value.
static URLRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = URLRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
);
instance.method = map['method'];
instance.body = map['body'];
instance.headers = map['headers'];
instance.iosAllowsCellularAccess = map['allowsCellularAccess'];
instance.allowsCellularAccess = map['allowsCellularAccess'];
instance.iosAllowsConstrainedNetworkAccess =
map['allowsConstrainedNetworkAccess'];
instance.allowsConstrainedNetworkAccess =
map['allowsConstrainedNetworkAccess'];
instance.iosAllowsExpensiveNetworkAccess =
map['allowsExpensiveNetworkAccess'];
instance.allowsExpensiveNetworkAccess = map['allowsExpensiveNetworkAccess'];
instance.iosCachePolicy =
IOSURLRequestCachePolicy.fromNativeValue(map['cachePolicy']);
instance.cachePolicy =
URLRequestCachePolicy.fromNativeValue(map['cachePolicy']);
instance.iosHttpShouldHandleCookies = map['httpShouldHandleCookies'];
instance.httpShouldHandleCookies = map['httpShouldHandleCookies'];
instance.iosHttpShouldUsePipelining = map['httpShouldUsePipelining'];
instance.httpShouldUsePipelining = map['httpShouldUsePipelining'];
instance.iosNetworkServiceType =
IOSURLRequestNetworkServiceType.fromNativeValue(
map['networkServiceType']);
instance.networkServiceType =
URLRequestNetworkServiceType.fromNativeValue(map['networkServiceType']);
instance.iosTimeoutInterval = map['timeoutInterval'];
instance.timeoutInterval = map['timeoutInterval'];
instance.iosMainDocumentURL = map['mainDocumentURL'] != null
? Uri.parse(map['mainDocumentURL'])
: null;
instance.mainDocumentURL = map['mainDocumentURL'] != null
? Uri.parse(map['mainDocumentURL'])
: null;
instance.assumesHTTP3Capable = map['assumesHTTP3Capable'];
instance.attribution =
URLRequestAttribution.fromNativeValue(map['attribution']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"method": method,
"body": body,
"headers": headers,
"allowsCellularAccess": allowsCellularAccess,
"allowsConstrainedNetworkAccess": allowsConstrainedNetworkAccess,
"allowsExpensiveNetworkAccess": allowsExpensiveNetworkAccess,
"cachePolicy": cachePolicy?.toNativeValue(),
"httpShouldHandleCookies": httpShouldHandleCookies,
"httpShouldUsePipelining": httpShouldUsePipelining,
"networkServiceType": networkServiceType?.toNativeValue(),
"timeoutInterval": timeoutInterval,
"mainDocumentURL": mainDocumentURL?.toString(),
"assumesHTTP3Capable": assumesHTTP3Capable,
"attribution": attribution?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'URLRequest{url: $url, method: $method, body: $body, headers: $headers, allowsCellularAccess: $allowsCellularAccess, allowsConstrainedNetworkAccess: $allowsConstrainedNetworkAccess, allowsExpensiveNetworkAccess: $allowsExpensiveNetworkAccess, cachePolicy: $cachePolicy, httpShouldHandleCookies: $httpShouldHandleCookies, httpShouldUsePipelining: $httpShouldUsePipelining, networkServiceType: $networkServiceType, timeoutInterval: $timeoutInterval, mainDocumentURL: $mainDocumentURL, assumesHTTP3Capable: $assumesHTTP3Capable, attribution: $attribution}';
}
}

View File

@ -1,43 +1,15 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_request.dart'; import 'url_request.dart';
part 'url_request_attribution.g.dart';
///Class that represents the constants used to indicate the entities that can make a network request. ///Class that represents the constants used to indicate the entities that can make a network request.
class URLRequestAttribution { @ExchangeableEnum()
class URLRequestAttribution_ {
// ignore: unused_field
final int _value; final int _value;
const URLRequestAttribution_._internal(this._value);
const URLRequestAttribution._internal(this._value);
///Set of all values of [URLRequestAttribution].
static final Set<URLRequestAttribution> values = [
URLRequestAttribution.DEVELOPER,
URLRequestAttribution.USER,
].toSet();
///Gets a possible [URLRequestAttribution] instance from an [int] value.
static URLRequestAttribution? fromValue(int? value) {
if (value != null) {
try {
return URLRequestAttribution.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "USER";
case 0:
default:
return "DEVELOPER";
}
}
///A developer-initiated network request. ///A developer-initiated network request.
/// ///
@ -46,15 +18,10 @@ class URLRequestAttribution {
/// ///
///For cases where the user enters a URL, like in the navigation bar of a web browser, or taps or clicks a URL to load the content it represents, use the [URLRequestAttribution.USER] value instead. ///For cases where the user enters a URL, like in the navigation bar of a web browser, or taps or clicks a URL to load the content it represents, use the [URLRequestAttribution.USER] value instead.
static const DEVELOPER = static const DEVELOPER =
const URLRequestAttribution._internal(0); const URLRequestAttribution_._internal(0);
///Use this value for the attribution parameter of a [URLRequest] that satisfies a user request to access an explicit, unmodified URL. ///Use this value for the attribution parameter of a [URLRequest] that satisfies a user request to access an explicit, unmodified URL.
///In all other cases, use the [URLRequestAttribution.DEVELOPER] value instead. ///In all other cases, use the [URLRequestAttribution.DEVELOPER] value instead.
static const USER = static const USER =
const URLRequestAttribution._internal(1); const URLRequestAttribution_._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_request_attribution.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the constants used to indicate the entities that can make a network request.
class URLRequestAttribution {
final int _value;
final int _nativeValue;
const URLRequestAttribution._internal(this._value, this._nativeValue);
// ignore: unused_element
factory URLRequestAttribution._internalMultiPlatform(
int value, Function nativeValue) =>
URLRequestAttribution._internal(value, nativeValue());
///A developer-initiated network request.
///
///Use this value for the attribution parameter of a [URLRequest] that your app makes for any purpose other than when the user explicitly accesses a link.
///This includes requests that your app makes to get user data. This is the default value.
///
///For cases where the user enters a URL, like in the navigation bar of a web browser, or taps or clicks a URL to load the content it represents, use the [URLRequestAttribution.USER] value instead.
static const DEVELOPER = URLRequestAttribution._internal(0, 0);
///Use this value for the attribution parameter of a [URLRequest] that satisfies a user request to access an explicit, unmodified URL.
///In all other cases, use the [URLRequestAttribution.DEVELOPER] value instead.
static const USER = URLRequestAttribution._internal(1, 1);
///Set of all values of [URLRequestAttribution].
static final Set<URLRequestAttribution> values = [
URLRequestAttribution.DEVELOPER,
URLRequestAttribution.USER,
].toSet();
///Gets a possible [URLRequestAttribution] instance from [int] value.
static URLRequestAttribution? fromValue(int? value) {
if (value != null) {
try {
return URLRequestAttribution.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [URLRequestAttribution] instance from a native value.
static URLRequestAttribution? fromNativeValue(int? value) {
if (value != null) {
try {
return URLRequestAttribution.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'DEVELOPER';
case 1:
return 'USER';
}
return _value.toString();
}
}

View File

@ -1,69 +1,29 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'url_request_cache_policy.g.dart';
///Class that represents the constants used to specify interaction with the cached responses. ///Class that represents the constants used to specify interaction with the cached responses.
class URLRequestCachePolicy { @ExchangeableEnum()
class URLRequestCachePolicy_ {
// ignore: unused_field
final int _value; final int _value;
const URLRequestCachePolicy_._internal(this._value);
const URLRequestCachePolicy._internal(this._value);
///Set of all values of [URLRequestCachePolicy].
static final Set<URLRequestCachePolicy> values = [
URLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY,
URLRequestCachePolicy.RELOAD_IGNORING_LOCAL_CACHE_DATA,
URLRequestCachePolicy.RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA,
URLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD,
URLRequestCachePolicy.RETURN_CACHE_DATA_DONT_LOAD,
URLRequestCachePolicy.RELOAD_REVALIDATING_CACHE_DATA,
].toSet();
///Gets a possible [URLRequestCachePolicy] instance from an [int] value.
static URLRequestCachePolicy? fromValue(int? value) {
if (value != null) {
try {
return URLRequestCachePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "RELOAD_IGNORING_LOCAL_CACHE_DATA";
case 2:
return "RETURN_CACHE_DATA_ELSE_LOAD";
case 3:
return "RETURN_CACHE_DATA_DONT_LOAD";
case 4:
return "RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA";
case 5:
return "RELOAD_REVALIDATING_CACHE_DATA";
case 0:
default:
return "USE_PROTOCOL_CACHE_POLICY";
}
}
///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request. ///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
///This is the default policy for URL load requests. ///This is the default policy for URL load requests.
static const USE_PROTOCOL_CACHE_POLICY = static const USE_PROTOCOL_CACHE_POLICY =
const URLRequestCachePolicy._internal(0); const URLRequestCachePolicy_._internal(0);
///The URL load should be loaded only from the originating source. ///The URL load should be loaded only from the originating source.
///This policy specifies that no existing cache data should be used to satisfy a URL load request. ///This policy specifies that no existing cache data should be used to satisfy a URL load request.
/// ///
///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests. ///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests.
static const RELOAD_IGNORING_LOCAL_CACHE_DATA = static const RELOAD_IGNORING_LOCAL_CACHE_DATA =
const URLRequestCachePolicy._internal(1); const URLRequestCachePolicy_._internal(1);
///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data. ///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
static const RETURN_CACHE_DATA_ELSE_LOAD = static const RETURN_CACHE_DATA_ELSE_LOAD =
const URLRequestCachePolicy._internal(2); const URLRequestCachePolicy_._internal(2);
///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available. ///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
/// ///
@ -71,94 +31,45 @@ class URLRequestCachePolicy {
///no attempt is made to load the data from the originating source, and the load is considered to have failed. ///no attempt is made to load the data from the originating source, and the load is considered to have failed.
///This constant specifies a behavior that is similar to an offline mode. ///This constant specifies a behavior that is similar to an offline mode.
static const RETURN_CACHE_DATA_DONT_LOAD = static const RETURN_CACHE_DATA_DONT_LOAD =
const URLRequestCachePolicy._internal(3); const URLRequestCachePolicy_._internal(3);
///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows. ///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
/// ///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant. ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA = static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA =
const URLRequestCachePolicy._internal(4); const URLRequestCachePolicy_._internal(4);
///Use cache data if the origin source can validate it; otherwise, load from the origin. ///Use cache data if the origin source can validate it; otherwise, load from the origin.
/// ///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant. ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_REVALIDATING_CACHE_DATA = static const RELOAD_REVALIDATING_CACHE_DATA =
const URLRequestCachePolicy._internal(5); const URLRequestCachePolicy_._internal(5);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An iOS-specific Class that represents the constants used to specify interaction with the cached responses. ///An iOS-specific Class that represents the constants used to specify interaction with the cached responses.
///Use [URLRequestCachePolicy] instead. ///Use [URLRequestCachePolicy] instead.
@Deprecated("Use URLRequestCachePolicy instead") @Deprecated("Use URLRequestCachePolicy instead")
class IOSURLRequestCachePolicy { @ExchangeableEnum()
class IOSURLRequestCachePolicy_ {
// ignore: unused_field
final int _value; final int _value;
const IOSURLRequestCachePolicy_._internal(this._value);
const IOSURLRequestCachePolicy._internal(this._value);
///Set of all values of [IOSURLRequestCachePolicy].
static final Set<IOSURLRequestCachePolicy> values = [
IOSURLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY,
IOSURLRequestCachePolicy.RELOAD_IGNORING_LOCAL_CACHE_DATA,
IOSURLRequestCachePolicy.RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA,
IOSURLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD,
IOSURLRequestCachePolicy.RETURN_CACHE_DATA_DONT_LOAD,
IOSURLRequestCachePolicy.RELOAD_REVALIDATING_CACHE_DATA,
].toSet();
///Gets a possible [IOSURLRequestCachePolicy] instance from an [int] value.
static IOSURLRequestCachePolicy? fromValue(int? value) {
if (value != null) {
try {
return IOSURLRequestCachePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "RELOAD_IGNORING_LOCAL_CACHE_DATA";
case 2:
return "RETURN_CACHE_DATA_ELSE_LOAD";
case 3:
return "RETURN_CACHE_DATA_DONT_LOAD";
case 4:
return "RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA";
case 5:
return "RELOAD_REVALIDATING_CACHE_DATA";
case 0:
default:
return "USE_PROTOCOL_CACHE_POLICY";
}
}
///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request. ///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
///This is the default policy for URL load requests. ///This is the default policy for URL load requests.
static const USE_PROTOCOL_CACHE_POLICY = static const USE_PROTOCOL_CACHE_POLICY =
const IOSURLRequestCachePolicy._internal(0); const IOSURLRequestCachePolicy_._internal(0);
///The URL load should be loaded only from the originating source. ///The URL load should be loaded only from the originating source.
///This policy specifies that no existing cache data should be used to satisfy a URL load request. ///This policy specifies that no existing cache data should be used to satisfy a URL load request.
/// ///
///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests. ///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests.
static const RELOAD_IGNORING_LOCAL_CACHE_DATA = static const RELOAD_IGNORING_LOCAL_CACHE_DATA =
const IOSURLRequestCachePolicy._internal(1); const IOSURLRequestCachePolicy_._internal(1);
///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data. ///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
static const RETURN_CACHE_DATA_ELSE_LOAD = static const RETURN_CACHE_DATA_ELSE_LOAD =
const IOSURLRequestCachePolicy._internal(2); const IOSURLRequestCachePolicy_._internal(2);
///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available. ///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
/// ///
@ -166,22 +77,17 @@ class IOSURLRequestCachePolicy {
///no attempt is made to load the data from the originating source, and the load is considered to have failed. ///no attempt is made to load the data from the originating source, and the load is considered to have failed.
///This constant specifies a behavior that is similar to an offline mode. ///This constant specifies a behavior that is similar to an offline mode.
static const RETURN_CACHE_DATA_DONT_LOAD = static const RETURN_CACHE_DATA_DONT_LOAD =
const IOSURLRequestCachePolicy._internal(3); const IOSURLRequestCachePolicy_._internal(3);
///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows. ///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
/// ///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant. ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA = static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA =
const IOSURLRequestCachePolicy._internal(4); const IOSURLRequestCachePolicy_._internal(4);
///Use cache data if the origin source can validate it; otherwise, load from the origin. ///Use cache data if the origin source can validate it; otherwise, load from the origin.
/// ///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant. ///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_REVALIDATING_CACHE_DATA = static const RELOAD_REVALIDATING_CACHE_DATA =
const IOSURLRequestCachePolicy._internal(5); const IOSURLRequestCachePolicy_._internal(5);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,237 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_request_cache_policy.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the constants used to specify interaction with the cached responses.
class URLRequestCachePolicy {
final int _value;
final int _nativeValue;
const URLRequestCachePolicy._internal(this._value, this._nativeValue);
// ignore: unused_element
factory URLRequestCachePolicy._internalMultiPlatform(
int value, Function nativeValue) =>
URLRequestCachePolicy._internal(value, nativeValue());
///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
///This is the default policy for URL load requests.
static const USE_PROTOCOL_CACHE_POLICY =
URLRequestCachePolicy._internal(0, 0);
///The URL load should be loaded only from the originating source.
///This policy specifies that no existing cache data should be used to satisfy a URL load request.
///
///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests.
static const RELOAD_IGNORING_LOCAL_CACHE_DATA =
URLRequestCachePolicy._internal(1, 1);
///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
static const RETURN_CACHE_DATA_ELSE_LOAD =
URLRequestCachePolicy._internal(2, 2);
///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
///
///If there is no existing data in the cache corresponding to a URL load request,
///no attempt is made to load the data from the originating source, and the load is considered to have failed.
///This constant specifies a behavior that is similar to an offline mode.
static const RETURN_CACHE_DATA_DONT_LOAD =
URLRequestCachePolicy._internal(3, 3);
///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA =
URLRequestCachePolicy._internal(4, 4);
///Use cache data if the origin source can validate it; otherwise, load from the origin.
///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_REVALIDATING_CACHE_DATA =
URLRequestCachePolicy._internal(5, 5);
///Set of all values of [URLRequestCachePolicy].
static final Set<URLRequestCachePolicy> values = [
URLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY,
URLRequestCachePolicy.RELOAD_IGNORING_LOCAL_CACHE_DATA,
URLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD,
URLRequestCachePolicy.RETURN_CACHE_DATA_DONT_LOAD,
URLRequestCachePolicy.RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA,
URLRequestCachePolicy.RELOAD_REVALIDATING_CACHE_DATA,
].toSet();
///Gets a possible [URLRequestCachePolicy] instance from [int] value.
static URLRequestCachePolicy? fromValue(int? value) {
if (value != null) {
try {
return URLRequestCachePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [URLRequestCachePolicy] instance from a native value.
static URLRequestCachePolicy? fromNativeValue(int? value) {
if (value != null) {
try {
return URLRequestCachePolicy.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'USE_PROTOCOL_CACHE_POLICY';
case 1:
return 'RELOAD_IGNORING_LOCAL_CACHE_DATA';
case 2:
return 'RETURN_CACHE_DATA_ELSE_LOAD';
case 3:
return 'RETURN_CACHE_DATA_DONT_LOAD';
case 4:
return 'RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA';
case 5:
return 'RELOAD_REVALIDATING_CACHE_DATA';
}
return _value.toString();
}
}
///An iOS-specific Class that represents the constants used to specify interaction with the cached responses.
///Use [URLRequestCachePolicy] instead.
@Deprecated('Use URLRequestCachePolicy instead')
class IOSURLRequestCachePolicy {
final int _value;
final int _nativeValue;
const IOSURLRequestCachePolicy._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSURLRequestCachePolicy._internalMultiPlatform(
int value, Function nativeValue) =>
IOSURLRequestCachePolicy._internal(value, nativeValue());
///Use the caching logic defined in the protocol implementation, if any, for a particular URL load request.
///This is the default policy for URL load requests.
static const USE_PROTOCOL_CACHE_POLICY =
IOSURLRequestCachePolicy._internal(0, 0);
///The URL load should be loaded only from the originating source.
///This policy specifies that no existing cache data should be used to satisfy a URL load request.
///
///**NOTE**: Always use this policy if you are making HTTP or HTTPS byte-range requests.
static const RELOAD_IGNORING_LOCAL_CACHE_DATA =
IOSURLRequestCachePolicy._internal(1, 1);
///Use existing cache data, regardless or age or expiration date, loading from originating source only if there is no cached data.
static const RETURN_CACHE_DATA_ELSE_LOAD =
IOSURLRequestCachePolicy._internal(2, 2);
///Use existing cache data, regardless or age or expiration date, and fail if no cached data is available.
///
///If there is no existing data in the cache corresponding to a URL load request,
///no attempt is made to load the data from the originating source, and the load is considered to have failed.
///This constant specifies a behavior that is similar to an offline mode.
static const RETURN_CACHE_DATA_DONT_LOAD =
IOSURLRequestCachePolicy._internal(3, 3);
///Ignore local cache data, and instruct proxies and other intermediates to disregard their caches so far as the protocol allows.
///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA =
IOSURLRequestCachePolicy._internal(4, 4);
///Use cache data if the origin source can validate it; otherwise, load from the origin.
///
///**NOTE**: Versions earlier than macOS 15, iOS 13, watchOS 6, and tvOS 13 dont implement this constant.
static const RELOAD_REVALIDATING_CACHE_DATA =
IOSURLRequestCachePolicy._internal(5, 5);
///Set of all values of [IOSURLRequestCachePolicy].
static final Set<IOSURLRequestCachePolicy> values = [
IOSURLRequestCachePolicy.USE_PROTOCOL_CACHE_POLICY,
IOSURLRequestCachePolicy.RELOAD_IGNORING_LOCAL_CACHE_DATA,
IOSURLRequestCachePolicy.RETURN_CACHE_DATA_ELSE_LOAD,
IOSURLRequestCachePolicy.RETURN_CACHE_DATA_DONT_LOAD,
IOSURLRequestCachePolicy.RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA,
IOSURLRequestCachePolicy.RELOAD_REVALIDATING_CACHE_DATA,
].toSet();
///Gets a possible [IOSURLRequestCachePolicy] instance from [int] value.
static IOSURLRequestCachePolicy? fromValue(int? value) {
if (value != null) {
try {
return IOSURLRequestCachePolicy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSURLRequestCachePolicy] instance from a native value.
static IOSURLRequestCachePolicy? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSURLRequestCachePolicy.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'USE_PROTOCOL_CACHE_POLICY';
case 1:
return 'RELOAD_IGNORING_LOCAL_CACHE_DATA';
case 2:
return 'RETURN_CACHE_DATA_ELSE_LOAD';
case 3:
return 'RETURN_CACHE_DATA_DONT_LOAD';
case 4:
return 'RELOAD_IGNORING_LOCAL_AND_REMOTE_CACHE_DATA';
case 5:
return 'RELOAD_REVALIDATING_CACHE_DATA';
}
return _value.toString();
}
}

View File

@ -1,195 +1,89 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'url_request_network_service_type.g.dart';
///Class that represents the constants that specify how a request uses network resources. ///Class that represents the constants that specify how a request uses network resources.
class URLRequestNetworkServiceType { @ExchangeableEnum()
class URLRequestNetworkServiceType_ {
// ignore: unused_field
final int _value; final int _value;
const URLRequestNetworkServiceType_._internal(this._value);
const URLRequestNetworkServiceType._internal(this._value);
///Set of all values of [URLRequestNetworkServiceType].
static final Set<URLRequestNetworkServiceType> values = [
URLRequestNetworkServiceType.DEFAULT,
URLRequestNetworkServiceType.VIDEO,
URLRequestNetworkServiceType.BACKGROUND,
URLRequestNetworkServiceType.VOICE,
URLRequestNetworkServiceType.RESPONSIVE_DATA,
URLRequestNetworkServiceType.AV_STREAMING,
URLRequestNetworkServiceType.RESPONSIVE_AV,
URLRequestNetworkServiceType.CALL_SIGNALING,
].toSet();
///Gets a possible [URLRequestNetworkServiceType] instance from an [int] value.
static URLRequestNetworkServiceType? fromValue(int? value) {
if (value != null) {
try {
return URLRequestNetworkServiceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 2:
return "VIDEO";
case 3:
return "BACKGROUND";
case 4:
return "VOICE";
case 6:
return "RESPONSIVE_DATA";
case 8:
return "AV_STREAMING";
case 9:
return "RESPONSIVE_AV";
case 11:
return "CALL_SIGNALING";
case 0:
default:
return "DEFAULT";
}
}
///A service type for standard network traffic. ///A service type for standard network traffic.
static const DEFAULT = const URLRequestNetworkServiceType._internal(0); static const DEFAULT = const URLRequestNetworkServiceType_._internal(0);
///A service type for video traffic. ///A service type for video traffic.
static const VIDEO = const URLRequestNetworkServiceType._internal(2); static const VIDEO = const URLRequestNetworkServiceType_._internal(2);
///A service type for background traffic. ///A service type for background traffic.
/// ///
///You should specify this type if your app is performing a download that was not requested by the userfor example, ///You should specify this type if your app is performing a download that was not requested by the userfor example,
///prefetching content so that it will be available when the user chooses to view it. ///prefetching content so that it will be available when the user chooses to view it.
static const BACKGROUND = const URLRequestNetworkServiceType._internal(3); static const BACKGROUND = const URLRequestNetworkServiceType_._internal(3);
///A service type for voice traffic. ///A service type for voice traffic.
static const VOICE = const URLRequestNetworkServiceType._internal(4); static const VOICE = const URLRequestNetworkServiceType_._internal(4);
///A service type for data that the user is actively waiting for. ///A service type for data that the user is actively waiting for.
/// ///
///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase. ///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase.
static const RESPONSIVE_DATA = static const RESPONSIVE_DATA =
const URLRequestNetworkServiceType._internal(6); const URLRequestNetworkServiceType_._internal(6);
///A service type for streaming audio/video data. ///A service type for streaming audio/video data.
static const AV_STREAMING = const URLRequestNetworkServiceType._internal(8); static const AV_STREAMING = const URLRequestNetworkServiceType_._internal(8);
///A service type for responsive (time-sensitive) audio/video data. ///A service type for responsive (time-sensitive) audio/video data.
static const RESPONSIVE_AV = const URLRequestNetworkServiceType._internal(9); static const RESPONSIVE_AV = const URLRequestNetworkServiceType_._internal(9);
///A service type for call signaling. ///A service type for call signaling.
/// ///
///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call. ///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call.
static const CALL_SIGNALING = static const CALL_SIGNALING =
const URLRequestNetworkServiceType._internal(11); const URLRequestNetworkServiceType_._internal(11);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An iOS-specific Class that represents the constants that specify how a request uses network resources. ///An iOS-specific Class that represents the constants that specify how a request uses network resources.
///Use [URLRequestNetworkServiceType] instead. ///Use [URLRequestNetworkServiceType] instead.
@Deprecated("Use URLRequestNetworkServiceType instead") @Deprecated("Use URLRequestNetworkServiceType instead")
class IOSURLRequestNetworkServiceType { @ExchangeableEnum()
class IOSURLRequestNetworkServiceType_ {
// ignore: unused_field
final int _value; final int _value;
const IOSURLRequestNetworkServiceType_._internal(this._value);
const IOSURLRequestNetworkServiceType._internal(this._value);
///Set of all values of [IOSURLRequestNetworkServiceType].
static final Set<IOSURLRequestNetworkServiceType> values = [
IOSURLRequestNetworkServiceType.DEFAULT,
IOSURLRequestNetworkServiceType.VIDEO,
IOSURLRequestNetworkServiceType.BACKGROUND,
IOSURLRequestNetworkServiceType.VOICE,
IOSURLRequestNetworkServiceType.RESPONSIVE_DATA,
IOSURLRequestNetworkServiceType.AV_STREAMING,
IOSURLRequestNetworkServiceType.RESPONSIVE_AV,
IOSURLRequestNetworkServiceType.CALL_SIGNALING,
].toSet();
///Gets a possible [IOSURLRequestNetworkServiceType] instance from an [int] value.
static IOSURLRequestNetworkServiceType? fromValue(int? value) {
if (value != null) {
try {
return IOSURLRequestNetworkServiceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 2:
return "VIDEO";
case 3:
return "BACKGROUND";
case 4:
return "VOICE";
case 6:
return "RESPONSIVE_DATA";
case 8:
return "AV_STREAMING";
case 9:
return "RESPONSIVE_AV";
case 11:
return "CALL_SIGNALING";
case 0:
default:
return "DEFAULT";
}
}
///A service type for standard network traffic. ///A service type for standard network traffic.
static const DEFAULT = const IOSURLRequestNetworkServiceType._internal(0); static const DEFAULT = const IOSURLRequestNetworkServiceType_._internal(0);
///A service type for video traffic. ///A service type for video traffic.
static const VIDEO = const IOSURLRequestNetworkServiceType._internal(2); static const VIDEO = const IOSURLRequestNetworkServiceType_._internal(2);
///A service type for background traffic. ///A service type for background traffic.
/// ///
///You should specify this type if your app is performing a download that was not requested by the userfor example, ///You should specify this type if your app is performing a download that was not requested by the userfor example,
///prefetching content so that it will be available when the user chooses to view it. ///prefetching content so that it will be available when the user chooses to view it.
static const BACKGROUND = const IOSURLRequestNetworkServiceType._internal(3); static const BACKGROUND = const IOSURLRequestNetworkServiceType_._internal(3);
///A service type for voice traffic. ///A service type for voice traffic.
static const VOICE = const IOSURLRequestNetworkServiceType._internal(4); static const VOICE = const IOSURLRequestNetworkServiceType_._internal(4);
///A service type for data that the user is actively waiting for. ///A service type for data that the user is actively waiting for.
/// ///
///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase. ///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase.
static const RESPONSIVE_DATA = static const RESPONSIVE_DATA =
const IOSURLRequestNetworkServiceType._internal(6); const IOSURLRequestNetworkServiceType_._internal(6);
///A service type for streaming audio/video data. ///A service type for streaming audio/video data.
static const AV_STREAMING = static const AV_STREAMING =
const IOSURLRequestNetworkServiceType._internal(8); const IOSURLRequestNetworkServiceType_._internal(8);
///A service type for responsive (time-sensitive) audio/video data. ///A service type for responsive (time-sensitive) audio/video data.
static const RESPONSIVE_AV = static const RESPONSIVE_AV =
const IOSURLRequestNetworkServiceType._internal(9); const IOSURLRequestNetworkServiceType_._internal(9);
///A service type for call signaling. ///A service type for call signaling.
/// ///
///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call. ///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call.
static const CALL_SIGNALING = static const CALL_SIGNALING =
const IOSURLRequestNetworkServiceType._internal(11); const IOSURLRequestNetworkServiceType_._internal(11);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,242 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_request_network_service_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the constants that specify how a request uses network resources.
class URLRequestNetworkServiceType {
final int _value;
final int _nativeValue;
const URLRequestNetworkServiceType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory URLRequestNetworkServiceType._internalMultiPlatform(
int value, Function nativeValue) =>
URLRequestNetworkServiceType._internal(value, nativeValue());
///A service type for standard network traffic.
static const DEFAULT = URLRequestNetworkServiceType._internal(0, 0);
///A service type for video traffic.
static const VIDEO = URLRequestNetworkServiceType._internal(2, 2);
///A service type for background traffic.
///
///You should specify this type if your app is performing a download that was not requested by the userfor example,
///prefetching content so that it will be available when the user chooses to view it.
static const BACKGROUND = URLRequestNetworkServiceType._internal(3, 3);
///A service type for voice traffic.
static const VOICE = URLRequestNetworkServiceType._internal(4, 4);
///A service type for data that the user is actively waiting for.
///
///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase.
static const RESPONSIVE_DATA = URLRequestNetworkServiceType._internal(6, 6);
///A service type for streaming audio/video data.
static const AV_STREAMING = URLRequestNetworkServiceType._internal(8, 8);
///A service type for responsive (time-sensitive) audio/video data.
static const RESPONSIVE_AV = URLRequestNetworkServiceType._internal(9, 9);
///A service type for call signaling.
///
///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call.
static const CALL_SIGNALING = URLRequestNetworkServiceType._internal(11, 11);
///Set of all values of [URLRequestNetworkServiceType].
static final Set<URLRequestNetworkServiceType> values = [
URLRequestNetworkServiceType.DEFAULT,
URLRequestNetworkServiceType.VIDEO,
URLRequestNetworkServiceType.BACKGROUND,
URLRequestNetworkServiceType.VOICE,
URLRequestNetworkServiceType.RESPONSIVE_DATA,
URLRequestNetworkServiceType.AV_STREAMING,
URLRequestNetworkServiceType.RESPONSIVE_AV,
URLRequestNetworkServiceType.CALL_SIGNALING,
].toSet();
///Gets a possible [URLRequestNetworkServiceType] instance from [int] value.
static URLRequestNetworkServiceType? fromValue(int? value) {
if (value != null) {
try {
return URLRequestNetworkServiceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [URLRequestNetworkServiceType] instance from a native value.
static URLRequestNetworkServiceType? fromNativeValue(int? value) {
if (value != null) {
try {
return URLRequestNetworkServiceType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'DEFAULT';
case 2:
return 'VIDEO';
case 3:
return 'BACKGROUND';
case 4:
return 'VOICE';
case 6:
return 'RESPONSIVE_DATA';
case 8:
return 'AV_STREAMING';
case 9:
return 'RESPONSIVE_AV';
case 11:
return 'CALL_SIGNALING';
}
return _value.toString();
}
}
///An iOS-specific Class that represents the constants that specify how a request uses network resources.
///Use [URLRequestNetworkServiceType] instead.
@Deprecated('Use URLRequestNetworkServiceType instead')
class IOSURLRequestNetworkServiceType {
final int _value;
final int _nativeValue;
const IOSURLRequestNetworkServiceType._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory IOSURLRequestNetworkServiceType._internalMultiPlatform(
int value, Function nativeValue) =>
IOSURLRequestNetworkServiceType._internal(value, nativeValue());
///A service type for standard network traffic.
static const DEFAULT = IOSURLRequestNetworkServiceType._internal(0, 0);
///A service type for video traffic.
static const VIDEO = IOSURLRequestNetworkServiceType._internal(2, 2);
///A service type for background traffic.
///
///You should specify this type if your app is performing a download that was not requested by the userfor example,
///prefetching content so that it will be available when the user chooses to view it.
static const BACKGROUND = IOSURLRequestNetworkServiceType._internal(3, 3);
///A service type for voice traffic.
static const VOICE = IOSURLRequestNetworkServiceType._internal(4, 4);
///A service type for data that the user is actively waiting for.
///
///Use this service type for interactive situations where the user is anticipating a quick response, like instant messaging or completing a purchase.
static const RESPONSIVE_DATA =
IOSURLRequestNetworkServiceType._internal(6, 6);
///A service type for streaming audio/video data.
static const AV_STREAMING = IOSURLRequestNetworkServiceType._internal(8, 8);
///A service type for responsive (time-sensitive) audio/video data.
static const RESPONSIVE_AV = IOSURLRequestNetworkServiceType._internal(9, 9);
///A service type for call signaling.
///
///Use this service type with network traffic that establishes, maintains, or tears down a VoIP call.
static const CALL_SIGNALING =
IOSURLRequestNetworkServiceType._internal(11, 11);
///Set of all values of [IOSURLRequestNetworkServiceType].
static final Set<IOSURLRequestNetworkServiceType> values = [
IOSURLRequestNetworkServiceType.DEFAULT,
IOSURLRequestNetworkServiceType.VIDEO,
IOSURLRequestNetworkServiceType.BACKGROUND,
IOSURLRequestNetworkServiceType.VOICE,
IOSURLRequestNetworkServiceType.RESPONSIVE_DATA,
IOSURLRequestNetworkServiceType.AV_STREAMING,
IOSURLRequestNetworkServiceType.RESPONSIVE_AV,
IOSURLRequestNetworkServiceType.CALL_SIGNALING,
].toSet();
///Gets a possible [IOSURLRequestNetworkServiceType] instance from [int] value.
static IOSURLRequestNetworkServiceType? fromValue(int? value) {
if (value != null) {
try {
return IOSURLRequestNetworkServiceType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSURLRequestNetworkServiceType] instance from a native value.
static IOSURLRequestNetworkServiceType? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSURLRequestNetworkServiceType.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
///Gets [int] native value.
int toNativeValue() => _nativeValue;
@override
int get hashCode => _value.hashCode;
@override
bool operator ==(value) => value == _value;
@override
String toString() {
switch (_value) {
case 0:
return 'DEFAULT';
case 2:
return 'VIDEO';
case 3:
return 'BACKGROUND';
case 4:
return 'VOICE';
case 6:
return 'RESPONSIVE_DATA';
case 8:
return 'AV_STREAMING';
case 9:
return 'RESPONSIVE_AV';
case 11:
return 'CALL_SIGNALING';
}
return _value.toString();
}
}

View File

@ -1,5 +1,10 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'window_features.g.dart';
///Class that specifies optional attributes for the containing window when a new web view is requested. ///Class that specifies optional attributes for the containing window when a new web view is requested.
class WindowFeatures { @ExchangeableObject()
class WindowFeatures_ {
///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified. ///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified.
bool? allowsResizing; bool? allowsResizing;
@ -24,7 +29,7 @@ class WindowFeatures {
///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified. ///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified.
double? y; double? y;
WindowFeatures( WindowFeatures_(
{this.allowsResizing, {this.allowsResizing,
this.height, this.height,
this.menuBarVisibility, this.menuBarVisibility,
@ -33,52 +38,13 @@ class WindowFeatures {
this.width, this.width,
this.x, this.x,
this.y}); this.y});
///Gets a possible [WindowFeatures] instance from a [Map] value.
static WindowFeatures? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return WindowFeatures(
allowsResizing: map["allowsResizing"],
height: map["height"],
menuBarVisibility: map["menuBarVisibility"],
statusBarVisibility: map["statusBarVisibility"],
toolbarsVisibility: map["toolbarsVisibility"],
width: map["width"],
x: map["x"],
y: map["y"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"allowsResizing": allowsResizing,
"height": height,
"menuBarVisibility": menuBarVisibility,
"statusBarVisibility": statusBarVisibility,
"toolbarsVisibility": toolbarsVisibility,
"width": width,
"x": x,
"y": y,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }
///An iOS-specific class that specifies optional attributes for the containing window when a new web view is requested. ///An iOS-specific class that specifies optional attributes for the containing window when a new web view is requested.
///Use [WindowFeatures] instead. ///Use [WindowFeatures] instead.
@Deprecated("Use WindowFeatures instead") @Deprecated("Use WindowFeatures instead")
class IOSWKWindowFeatures { @ExchangeableObject()
class IOSWKWindowFeatures_ {
///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified. ///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified.
bool? allowsResizing; bool? allowsResizing;
@ -103,7 +69,7 @@ class IOSWKWindowFeatures {
///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified. ///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified.
double? y; double? y;
IOSWKWindowFeatures( IOSWKWindowFeatures_(
{this.allowsResizing, {this.allowsResizing,
this.height, this.height,
this.menuBarVisibility, this.menuBarVisibility,
@ -112,44 +78,4 @@ class IOSWKWindowFeatures {
this.width, this.width,
this.x, this.x,
this.y}); this.y});
///Gets a possible [IOSWKWindowFeatures] instance from a [Map] value.
static IOSWKWindowFeatures? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return IOSWKWindowFeatures(
allowsResizing: map["allowsResizing"],
height: map["height"],
menuBarVisibility: map["menuBarVisibility"],
statusBarVisibility: map["statusBarVisibility"],
toolbarsVisibility: map["toolbarsVisibility"],
width: map["width"],
x: map["x"],
y: map["y"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"allowsResizing": allowsResizing,
"height": height,
"menuBarVisibility": menuBarVisibility,
"statusBarVisibility": statusBarVisibility,
"toolbarsVisibility": toolbarsVisibility,
"width": width,
"x": x,
"y": y,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,163 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'window_features.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that specifies optional attributes for the containing window when a new web view is requested.
class WindowFeatures {
///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified.
bool? allowsResizing;
///A Double value specifying the height of the containing window, or `null` if the height is not specified.
double? height;
///A Boolean value indicating whether the menu bar should be visible, or `null` if menu bar visibility is not specified.
bool? menuBarVisibility;
///A Boolean value indicating whether the status bar should be visible, or `null` if status bar visibility is not specified.
bool? statusBarVisibility;
///A Boolean value indicating whether toolbars should be visible, or `null` if toolbars visibility is not specified.
bool? toolbarsVisibility;
///A Double value specifying the width of the containing window, or `null` if the width is not specified.
double? width;
///A Double value specifying the x-coordinate of the containing window, or `null` if the x-coordinate is not specified.
double? x;
///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified.
double? y;
WindowFeatures(
{this.allowsResizing,
this.height,
this.menuBarVisibility,
this.statusBarVisibility,
this.toolbarsVisibility,
this.width,
this.x,
this.y});
///Gets a possible [WindowFeatures] instance from a [Map] value.
static WindowFeatures? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = WindowFeatures();
instance.allowsResizing = map['allowsResizing'];
instance.height = map['height'];
instance.menuBarVisibility = map['menuBarVisibility'];
instance.statusBarVisibility = map['statusBarVisibility'];
instance.toolbarsVisibility = map['toolbarsVisibility'];
instance.width = map['width'];
instance.x = map['x'];
instance.y = map['y'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"allowsResizing": allowsResizing,
"height": height,
"menuBarVisibility": menuBarVisibility,
"statusBarVisibility": statusBarVisibility,
"toolbarsVisibility": toolbarsVisibility,
"width": width,
"x": x,
"y": y,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'WindowFeatures{allowsResizing: $allowsResizing, height: $height, menuBarVisibility: $menuBarVisibility, statusBarVisibility: $statusBarVisibility, toolbarsVisibility: $toolbarsVisibility, width: $width, x: $x, y: $y}';
}
}
///An iOS-specific class that specifies optional attributes for the containing window when a new web view is requested.
///Use [WindowFeatures] instead.
@Deprecated('Use WindowFeatures instead')
class IOSWKWindowFeatures {
///A Boolean value indicating whether the containing window should be resizable, or `null` if resizability is not specified.
bool? allowsResizing;
///A Double value specifying the height of the containing window, or `null` if the height is not specified.
double? height;
///A Boolean value indicating whether the menu bar should be visible, or `null` if menu bar visibility is not specified.
bool? menuBarVisibility;
///A Boolean value indicating whether the status bar should be visible, or `null` if status bar visibility is not specified.
bool? statusBarVisibility;
///A Boolean value indicating whether toolbars should be visible, or `null` if toolbars visibility is not specified.
bool? toolbarsVisibility;
///A Double value specifying the width of the containing window, or `null` if the width is not specified.
double? width;
///A Double value specifying the x-coordinate of the containing window, or `null` if the x-coordinate is not specified.
double? x;
///A Double value specifying the y-coordinate of the containing window, or `null` if the y-coordinate is not specified.
double? y;
IOSWKWindowFeatures(
{this.allowsResizing,
this.height,
this.menuBarVisibility,
this.statusBarVisibility,
this.toolbarsVisibility,
this.width,
this.x,
this.y});
///Gets a possible [IOSWKWindowFeatures] instance from a [Map] value.
static IOSWKWindowFeatures? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = IOSWKWindowFeatures();
instance.allowsResizing = map['allowsResizing'];
instance.height = map['height'];
instance.menuBarVisibility = map['menuBarVisibility'];
instance.statusBarVisibility = map['statusBarVisibility'];
instance.toolbarsVisibility = map['toolbarsVisibility'];
instance.width = map['width'];
instance.x = map['x'];
instance.y = map['y'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"allowsResizing": allowsResizing,
"height": height,
"menuBarVisibility": menuBarVisibility,
"statusBarVisibility": statusBarVisibility,
"toolbarsVisibility": toolbarsVisibility,
"width": width,
"x": x,
"y": y,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'IOSWKWindowFeatures{allowsResizing: $allowsResizing, height: $height, menuBarVisibility: $menuBarVisibility, statusBarVisibility: $statusBarVisibility, toolbarsVisibility: $toolbarsVisibility, width: $width, x: $x, y: $y}';
}
}