converted other exchangable objects and enums

This commit is contained in:
Lorenzo Pichilli 2022-06-09 10:36:13 +02:00
parent 015b5f33ab
commit 389cfe5a12
208 changed files with 11260 additions and 4707 deletions

View File

@ -19,6 +19,7 @@
- On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`)
- All properties of `GeolocationPermissionShowPromptResponse` cannot be `null`
- Removed `URLProtectionSpace.iosIsProxy` property
- `historyUrl` and `baseUrl` of `InAppWebViewInitialData` can be `null`
## 5.4.3+7

View File

@ -925,8 +925,7 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
@Nullable
@Override
public NavigationActionPolicy decodeResult(@Nullable Object obj) {
Integer action = Util.<Integer>getOrDefault((Map<String, Object>) obj,
"action", NavigationActionPolicy.CANCEL.rawValue());
Integer action = obj instanceof Integer ? (Integer) obj : NavigationActionPolicy.CANCEL.rawValue();
return NavigationActionPolicy.fromValue(action);
}
}
@ -1067,7 +1066,7 @@ public class WebViewChannelDelegate extends ChannelDelegateImpl {
@Nullable
@Override
public Integer decodeResult(@Nullable Object obj) {
return obj != null ? (Integer) ((Map<String, Object>) obj).get("action") : null;
return obj instanceof Integer ? (Integer) obj : null;
}
}

View File

@ -95,6 +95,15 @@ class ExchangeableObjectGenerator
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(fieldElement)?.getField("message")?.toStringValue()}')");
}
if (fieldElement.isStatic) {
classBuffer.write("static ");
}
if (fieldElement.isFinal) {
classBuffer.write("final ");
}
if (fieldElement.isConst) {
classBuffer.write("const ");
}
// remove class reference terminating with "_"
classBuffer
.write("${fieldElement.type.toString().replaceFirst("_", "")} ");
@ -104,7 +113,11 @@ class ExchangeableObjectGenerator
ParsedLibraryResult parsed = fieldElement.session
?.getParsedLibraryByElement(fieldElement.library)
as ParsedLibraryResult;
final fieldBody = parsed.getElementDeclaration(fieldElement)?.node;
final fieldBody = parsed
.getElementDeclaration(fieldElement)
?.node
.toString()
.replaceAll(className, extClassName);
classBuffer.writeln("$fieldBody;");
}
}
@ -161,9 +174,15 @@ class ExchangeableObjectGenerator
.replaceAll("@ExchangeableObjectConstructor()", ""));
}
} else if (constructorFields.length > 0) {
if (visitor.constructor.isConst) {
classBuffer.write('const ');
}
classBuffer.writeln('$extClassName({');
classBuffer.writeln(constructorFields.join(', '));
} else {
if (visitor.constructor.isConst) {
classBuffer.write('const ');
}
classBuffer.writeln('$extClassName(');
}
@ -201,15 +220,21 @@ class ExchangeableObjectGenerator
classBuffer.write('$fieldName = $fieldName ?? ');
if (fieldTypeElement != null && deprecatedFieldTypeElement != null) {
final isNullable = Util.typeIsNullable(fieldElement.type);
final deprecatedIsNullable = Util.typeIsNullable(deprecatedField.type);
final deprecatedIsNullable =
Util.typeIsNullable(deprecatedField.type);
final hasFromMap = hasFromMapMethod(fieldTypeElement);
final hasFromNativeValue = hasFromNativeValueMethod(fieldTypeElement);
final hasFromNativeValue =
hasFromNativeValueMethod(fieldTypeElement);
final hasFromValue = hasFromValueMethod(fieldTypeElement);
final deprecatedHasToMap = hasFromMapMethod(deprecatedFieldTypeElement);
final deprecatedHasToNativeValue = hasToNativeValueMethod(deprecatedFieldTypeElement);
final deprecatedHasToValue = hasToValueMethod(deprecatedFieldTypeElement);
final deprecatedHasToMap =
hasFromMapMethod(deprecatedFieldTypeElement);
final deprecatedHasToNativeValue =
hasToNativeValueMethod(deprecatedFieldTypeElement);
final deprecatedHasToValue =
hasToValueMethod(deprecatedFieldTypeElement);
if (hasFromMap && deprecatedHasToMap) {
final hasNullableFromMap = hasNullableFromMapFactory(fieldTypeElement);
final hasNullableFromMap =
hasNullableFromMapFactory(fieldTypeElement);
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
".fromMap($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toMap())${!isNullable && hasNullableFromMap ? '!' : ''}");
} else if (hasFromNativeValue && deprecatedHasToNativeValue) {
@ -254,7 +279,9 @@ class ExchangeableObjectGenerator
final requiredFields = <String>[];
for (final fieldElement in fieldElements) {
final fieldName = fieldElement.name;
if (!fieldElement.isPrivate) {
if (!fieldElement.isPrivate &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
var value = "map['$fieldName']";
final deprecationMessage = _coreCheckerDeprecated
.firstAnnotationOfExact(fieldElement)
@ -273,19 +300,21 @@ class ExchangeableObjectGenerator
?.getField("deserializer")
?.toFunctionValue();
if (customDeserializer != null) {
final deserializerClassName = customDeserializer.enclosingElement.name;
final deserializerClassName =
customDeserializer.enclosingElement.name;
if (deserializerClassName != null) {
value = "$deserializerClassName.${customDeserializer.name}($value)";
value =
"$deserializerClassName.${customDeserializer.name}($value)";
} else {
value = "${customDeserializer.name}($value)";
}
} else {
value = getFromMapValue(value, fieldElement.type);
}
final constructorParameter =
visitor.constructorParameters[fieldName];
final constructorParameter = visitor.constructorParameters[fieldName];
final isRequiredParameter = constructorParameter != null &&
(constructorParameter.isRequiredNamed ||
constructorParameter.isFinal ||
!Util.typeIsNullable(constructorParameter.type)) &&
!constructorParameter.hasDefaultValue;
if (isRequiredParameter) {
@ -332,19 +361,28 @@ class ExchangeableObjectGenerator
final fieldElements = <FieldElement>[];
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
fieldElements.add(fieldElement);
}
}
}
for (final entry in visitor.fields.entries) {
final fieldElement = entry.value;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
fieldElements.add(fieldElement);
}
}
for (final fieldElement in fieldElements) {
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
final fieldName = fieldElement.name;
var mapValue = fieldName;
final customSerializer = _coreCheckerObjectProperty
@ -354,7 +392,8 @@ class ExchangeableObjectGenerator
if (customSerializer != null) {
final serializerClassName = customSerializer.enclosingElement.name;
if (serializerClassName != null) {
mapValue = "$serializerClassName.${customSerializer.name}($mapValue)";
mapValue =
"$serializerClassName.${customSerializer.name}($mapValue)";
} else {
mapValue = "${customSerializer.name}($mapValue)";
}
@ -386,7 +425,10 @@ class ExchangeableObjectGenerator
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
final fieldName = fieldElement.name;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
fieldNames.add('$fieldName: \$$fieldName');
}
}
@ -394,7 +436,10 @@ class ExchangeableObjectGenerator
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
if (!fieldElement.isPrivate &&
!fieldElement.hasDeprecated &&
!fieldElement.isStatic &&
!fieldElement.type.isDartCoreFunction) {
fieldNames.add('$fieldName: \$$fieldName');
}
}
@ -412,7 +457,7 @@ class ExchangeableObjectGenerator
final isNullable = Util.typeIsNullable(elementType);
if (elementType.getDisplayString(withNullability: false) == "Uri") {
if (!isNullable) {
return "Uri.parse($value)!";
return "Uri.parse($value)";
} else {
return "$value != null ? Uri.parse($value) : null";
}
@ -423,6 +468,11 @@ class ExchangeableObjectGenerator
} else {
return "$value != null ? UtilColor.fromStringRepresentation($value) : null";
}
} else if (elementType.getDisplayString(withNullability: false) ==
"EdgeInsets") {
return "MapEdgeInsets.fromMap($value?.cast<String, dynamic>())${isNullable ? '!' : ''}";
} else if (elementType.getDisplayString(withNullability: false) == "Size") {
return "MapSize.fromMap($value?.cast<String, dynamic>())${isNullable ? '!' : ''}";
} else if (elementType.getDisplayString(withNullability: false) ==
"DateTime") {
if (!isNullable) {
@ -480,6 +530,11 @@ class ExchangeableObjectGenerator
} else if (elementType.getDisplayString(withNullability: false) ==
"Color") {
return fieldName + (isNullable ? '?' : '') + '.toHex()';
} else if (elementType.getDisplayString(withNullability: false) ==
"EdgeInsets") {
return fieldName + (isNullable ? '?' : '') + '.toMap()';
} else if (elementType.getDisplayString(withNullability: false) == "Size") {
return fieldName + (isNullable ? '?' : '') + '.toMap()';
} else if (elementType.getDisplayString(withNullability: false) ==
"DateTime") {
return fieldName + (isNullable ? '?' : '') + '.millisecondsSinceEpoch';
@ -493,7 +548,6 @@ class ExchangeableObjectGenerator
getToMapValue('$genericTypeFieldName', genericType) +
').toList()';
} else {
return fieldName;
}
} else if (fieldTypeElement != null && hasToMapMethod(fieldTypeElement)) {

View File

@ -28,6 +28,8 @@ class TestClass_ extends TestClass3_ {
List<Color?>? colors;
Function? onLoad;
///Docs 3
@SupportedPlatforms(platforms: [
AndroidPlatform(
@ -55,6 +57,7 @@ class TestClass_ extends TestClass3_ {
class TestClass3_ {
String asd;
Function? onLoad;
TestClass3_({required this.asd});
}

View File

@ -163,7 +163,7 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega
}
}
else if let initialData = initialData {
let baseUrl = URL(string: initialBaseUrl!)!
let baseUrl = URL(string: initialBaseUrl ?? "about:blank")!
var allowingReadAccessToURL: URL? = nil
if let allowingReadAccessTo = webView?.settings?.allowingReadAccessTo, baseUrl.scheme == "file" {
allowingReadAccessToURL = URL(string: allowingReadAccessTo)

View File

@ -148,7 +148,7 @@ public class FlutterWebViewController: NSObject, FlutterPlatformView, Disposable
let data = initialData["data"]!
let mimeType = initialData["mimeType"]!
let encoding = initialData["encoding"]!
let baseUrl = URL(string: initialData["baseUrl"]!)!
let baseUrl = URL(string: initialData["baseUrl"] ?? "about:blank")!
var allowingReadAccessToURL: URL? = nil
if let allowingReadAccessTo = webView.settings?.allowingReadAccessTo, baseUrl.scheme == "file" {
allowingReadAccessToURL = URL(string: allowingReadAccessTo)

View File

@ -828,7 +828,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
override init() {
super.init()
self.decodeResult = { (obj: Any?) in
if let obj = obj as? [String: Any?], let action = obj["action"] as? Int {
if let action = obj as? Int {
return WKNavigationActionPolicy.init(rawValue: action) ?? WKNavigationActionPolicy.cancel
}
return WKNavigationActionPolicy.cancel
@ -987,7 +987,7 @@ public class WebViewChannelDelegate : ChannelDelegate {
override init() {
super.init()
self.decodeResult = { (obj: Any?) in
if let obj = obj as? [String: Any?], let action = obj["action"] as? Int {
if let action = obj as? Int {
return WKNavigationResponsePolicy.init(rawValue: action) ?? WKNavigationResponsePolicy.cancel
}
return WKNavigationResponsePolicy.cancel

View File

@ -243,10 +243,10 @@ class InAppWebViewController {
if (_webview != null && _webview!.shouldOverrideUrlLoading != null)
return (await _webview!.shouldOverrideUrlLoading!(
this, navigationAction))
?.toMap();
?.toNativeValue();
return (await _inAppBrowser!
.shouldOverrideUrlLoading(navigationAction))
?.toMap();
?.toNativeValue();
}
break;
case "onConsoleMessage":
@ -525,17 +525,17 @@ class InAppWebViewController {
if (_webview != null) {
if (_webview!.onFormResubmission != null)
return (await _webview!.onFormResubmission!(this, uri))?.toMap();
return (await _webview!.onFormResubmission!(this, uri))?.toNativeValue();
else {
// ignore: deprecated_member_use_from_same_package
return (await _webview!.androidOnFormResubmission!(this, uri))
?.toMap();
?.toNativeValue();
}
} else {
return ((await _inAppBrowser!.onFormResubmission(uri)) ??
// ignore: deprecated_member_use_from_same_package
(await _inAppBrowser!.androidOnFormResubmission(uri)))
?.toMap();
?.toNativeValue();
}
}
break;
@ -924,21 +924,21 @@ class InAppWebViewController {
if (_webview!.onNavigationResponse != null)
return (await _webview!.onNavigationResponse!(
this, navigationResponse))
?.toMap();
?.toNativeValue();
else {
// ignore: deprecated_member_use_from_same_package
return (await _webview!.iosOnNavigationResponse!(
this, iosOnNavigationResponse))
?.toMap();
?.toNativeValue();
}
} else {
return (await _inAppBrowser!
.onNavigationResponse(navigationResponse))
?.toMap() ??
?.toNativeValue() ??
(await _inAppBrowser!
// ignore: deprecated_member_use_from_same_package
.iosOnNavigationResponse(iosOnNavigationResponse))
?.toMap();
?.toNativeValue();
}
}
break;
@ -3337,7 +3337,7 @@ class InAppWebViewController {
///- iOS ([Official API - WKWebView.setCameraCaptureState](https://developer.apple.com/documentation/webkit/wkwebview/3763097-setcameracapturestate)).
Future<void> setCameraCaptureState({required MediaCaptureState state}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('state', () => state.toValue());
args.putIfAbsent('state', () => state.toNativeValue());
await _channel.invokeMethod('setCameraCaptureState', args);
}
@ -3362,7 +3362,7 @@ class InAppWebViewController {
Future<void> setMicrophoneCaptureState(
{required MediaCaptureState state}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('state', () => state.toValue());
args.putIfAbsent('state', () => state.toNativeValue());
await _channel.invokeMethod('setMicrophoneCaptureState', args);
}

View File

@ -100,29 +100,28 @@ class AjaxRequest {
if (map == null) {
return null;
}
final instance = AjaxRequest();
instance.data = map['data'];
instance.method = map['method'];
instance.url = map['url'] != null ? Uri.parse(map['url']) : null;
instance.isAsync = map['isAsync'];
instance.user = map['user'];
instance.password = map['password'];
instance.withCredentials = map['withCredentials'];
instance.headers =
AjaxRequestHeaders.fromMap(map['headers']?.cast<String, dynamic>());
instance.readyState =
AjaxRequestReadyState.fromNativeValue(map['readyState']);
instance.status = map['status'];
instance.responseURL =
map['responseURL'] != null ? Uri.parse(map['responseURL']) : null;
instance.responseType = map['responseType'];
instance.response = map['response'];
instance.responseText = map['responseText'];
instance.responseXML = map['responseXML'];
instance.statusText = map['statusText'];
instance.responseHeaders = map['responseHeaders'];
instance.event =
AjaxRequestEvent.fromMap(map['event']?.cast<String, dynamic>());
final instance = AjaxRequest(
data: map['data'],
method: map['method'],
url: map['url'] != null ? Uri.parse(map['url']) : null,
isAsync: map['isAsync'],
user: map['user'],
password: map['password'],
withCredentials: map['withCredentials'],
headers:
AjaxRequestHeaders.fromMap(map['headers']?.cast<String, dynamic>()),
readyState: AjaxRequestReadyState.fromNativeValue(map['readyState']),
status: map['status'],
responseURL:
map['responseURL'] != null ? Uri.parse(map['responseURL']) : null,
responseType: map['responseType'],
response: map['response'],
responseText: map['responseText'],
responseXML: map['responseXML'],
statusText: map['statusText'],
responseHeaders: map['responseHeaders'],
event: AjaxRequestEvent.fromMap(map['event']?.cast<String, dynamic>()),
);
instance.action = AjaxRequestAction.fromNativeValue(map['action']);
return instance;
}

View File

@ -30,11 +30,12 @@ class AjaxRequestEvent {
if (map == null) {
return null;
}
final instance = AjaxRequestEvent();
instance.type = AjaxRequestEventType.fromNativeValue(map['type']);
instance.lengthComputable = map['lengthComputable'];
instance.loaded = map['loaded'];
instance.total = map['total'];
final instance = AjaxRequestEvent(
type: AjaxRequestEventType.fromNativeValue(map['type']),
lengthComputable: map['lengthComputable'],
loaded: map['loaded'],
total: map['total'],
);
return instance;
}

View File

@ -130,34 +130,33 @@ class AttributedString {
}
final instance = AttributedString(
string: map['string'],
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
baselineOffset: map['baselineOffset'],
expansion: map['expansion'],
foregroundColor: map['foregroundColor'] != null
? UtilColor.fromStringRepresentation(map['foregroundColor'])
: null,
kern: map['kern'],
ligature: map['ligature'],
obliqueness: map['obliqueness'],
strikethroughColor: map['strikethroughColor'] != null
? UtilColor.fromStringRepresentation(map['strikethroughColor'])
: null,
strikethroughStyle:
UnderlineStyle.fromNativeValue(map['strikethroughStyle']),
strokeColor: map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null,
strokeWidth: map['strokeWidth'],
textEffect:
AttributedStringTextEffectStyle.fromNativeValue(map['textEffect']),
underlineColor: map['underlineColor'] != null
? UtilColor.fromStringRepresentation(map['underlineColor'])
: null,
underlineStyle: UnderlineStyle.fromNativeValue(map['underlineStyle']),
);
instance.backgroundColor = map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null;
instance.baselineOffset = map['baselineOffset'];
instance.expansion = map['expansion'];
instance.foregroundColor = map['foregroundColor'] != null
? UtilColor.fromStringRepresentation(map['foregroundColor'])
: null;
instance.kern = map['kern'];
instance.ligature = map['ligature'];
instance.obliqueness = map['obliqueness'];
instance.strikethroughColor = map['strikethroughColor'] != null
? UtilColor.fromStringRepresentation(map['strikethroughColor'])
: null;
instance.strikethroughStyle =
UnderlineStyle.fromNativeValue(map['strikethroughStyle']);
instance.strokeColor = map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null;
instance.strokeWidth = map['strokeWidth'];
instance.textEffect =
AttributedStringTextEffectStyle.fromNativeValue(map['textEffect']);
instance.underlineColor = map['underlineColor'] != null
? UtilColor.fromStringRepresentation(map['underlineColor'])
: null;
instance.underlineStyle =
UnderlineStyle.fromNativeValue(map['underlineStyle']);
return instance;
}
@ -319,34 +318,34 @@ class IOSNSAttributedString {
}
final instance = IOSNSAttributedString(
string: map['string'],
backgroundColor: map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null,
baselineOffset: map['baselineOffset'],
expansion: map['expansion'],
foregroundColor: map['foregroundColor'] != null
? UtilColor.fromStringRepresentation(map['foregroundColor'])
: null,
kern: map['kern'],
ligature: map['ligature'],
obliqueness: map['obliqueness'],
strikethroughColor: map['strikethroughColor'] != null
? UtilColor.fromStringRepresentation(map['strikethroughColor'])
: null,
strikethroughStyle:
IOSNSUnderlineStyle.fromNativeValue(map['strikethroughStyle']),
strokeColor: map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null,
strokeWidth: map['strokeWidth'],
textEffect: IOSNSAttributedStringTextEffectStyle.fromNativeValue(
map['textEffect']),
underlineColor: map['underlineColor'] != null
? UtilColor.fromStringRepresentation(map['underlineColor'])
: null,
underlineStyle:
IOSNSUnderlineStyle.fromNativeValue(map['underlineStyle']),
);
instance.backgroundColor = map['backgroundColor'] != null
? UtilColor.fromStringRepresentation(map['backgroundColor'])
: null;
instance.baselineOffset = map['baselineOffset'];
instance.expansion = map['expansion'];
instance.foregroundColor = map['foregroundColor'] != null
? UtilColor.fromStringRepresentation(map['foregroundColor'])
: null;
instance.kern = map['kern'];
instance.ligature = map['ligature'];
instance.obliqueness = map['obliqueness'];
instance.strikethroughColor = map['strikethroughColor'] != null
? UtilColor.fromStringRepresentation(map['strikethroughColor'])
: null;
instance.strikethroughStyle =
IOSNSUnderlineStyle.fromNativeValue(map['strikethroughStyle']);
instance.strokeColor = map['strokeColor'] != null
? UtilColor.fromStringRepresentation(map['strokeColor'])
: null;
instance.strokeWidth = map['strokeWidth'];
instance.textEffect =
IOSNSAttributedStringTextEffectStyle.fromNativeValue(map['textEffect']);
instance.underlineColor = map['underlineColor'] != null
? UtilColor.fromStringRepresentation(map['underlineColor'])
: null;
instance.underlineStyle =
IOSNSUnderlineStyle.fromNativeValue(map['underlineStyle']);
return instance;
}

View File

@ -20,9 +20,10 @@ class CallAsyncJavaScriptResult {
if (map == null) {
return null;
}
final instance = CallAsyncJavaScriptResult();
instance.value = map['value'];
instance.error = map['error'];
final instance = CallAsyncJavaScriptResult(
value: map['value'],
error: map['error'],
);
return instance;
}

View File

@ -39,7 +39,7 @@ class ClientCertChallenge_ extends URLAuthenticationChallenge_ {
List<String>? keyTypes;
ClientCertChallenge_(
{required URLProtectionSpace protectionSpace,
{required URLProtectionSpace_ protectionSpace,
@Deprecated('Use principals instead') this.androidPrincipals,
this.principals,
@Deprecated('Use keyTypes instead') this.androidKeyTypes,

View File

@ -33,7 +33,7 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
this.principals,
@Deprecated('Use keyTypes instead') this.androidKeyTypes,
this.keyTypes,
dynamic protectionSpace})
required URLProtectionSpace protectionSpace})
: super(protectionSpace: protectionSpace) {
principals = principals ?? androidPrincipals;
keyTypes = keyTypes ?? androidKeyTypes;
@ -45,19 +45,20 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
return null;
}
final instance = ClientCertChallenge(
protectionSpace: map['protectionSpace'],
protectionSpace: URLProtectionSpace.fromMap(
map['protectionSpace']?.cast<String, dynamic>())!,
androidPrincipals: map['principals'],
principals: map['principals'],
androidKeyTypes: map['keyTypes'],
keyTypes: map['keyTypes'],
);
instance.androidPrincipals = map['principals'];
instance.principals = map['principals'];
instance.androidKeyTypes = map['keyTypes'];
instance.keyTypes = map['keyTypes'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace,
"protectionSpace": protectionSpace.toMap(),
"principals": principals,
"keyTypes": keyTypes,
};

View File

@ -67,15 +67,14 @@ class Cookie {
final instance = Cookie(
name: map['name'],
value: map['value'],
expiresDate: map['expiresDate'],
isSessionOnly: map['isSessionOnly'],
domain: map['domain'],
sameSite: HTTPCookieSameSitePolicy.fromNativeValue(map['sameSite']),
isSecure: map['isSecure'],
isHttpOnly: map['isHttpOnly'],
path: map['path'],
);
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;
}

View File

@ -84,6 +84,12 @@ class CreateWindowAction extends NavigationAction {
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>())!,
isForMainFrame: map['isForMainFrame'],
windowId: map['windowId'],
androidIsDialog: map['isDialog'],
isDialog: map['isDialog'],
iosWindowFeatures: IOSWKWindowFeatures.fromMap(
map['windowFeatures']?.cast<String, dynamic>()),
windowFeatures: WindowFeatures.fromMap(
map['windowFeatures']?.cast<String, dynamic>()),
);
instance.androidHasGesture = map['hasGesture'];
instance.hasGesture = map['hasGesture'];
@ -102,12 +108,6 @@ class CreateWindowAction extends NavigationAction {
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;
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_controller.dart';
import 'cross_origin.dart';
import 'referrer_policy.dart';
part 'css_link_html_tag_attributes.g.dart';
///Class that represents the possible CSS stylesheet `<link>` HTML attributes to be set used by [InAppWebViewController.injectCSSFileFromUrl].
class CSSLinkHtmlTagAttributes {
@ExchangeableObject()
class CSSLinkHtmlTagAttributes_ {
///The HTML [id] attribute is used to specify a unique id for the `<link>` HTML element.
String? id;
@ -13,13 +18,13 @@ class CSSLinkHtmlTagAttributes {
///Normal script elements pass minimal information to the `window.onerror` for scripts which do not pass the standard CORS checks.
///To allow error logging for sites which use a separate domain for static media, use this attribute.
CrossOrigin? crossOrigin;
CrossOrigin_? crossOrigin;
///This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation.
String? integrity;
///Indicates which referrer to send when fetching the script, or resources fetched by the script.
ReferrerPolicy? referrerPolicy;
ReferrerPolicy_? referrerPolicy;
///The [disabled] Boolean attribute indicates whether or not the described stylesheet should be loaded and applied to the document.
///If [disabled] is specified in the HTML when it is loaded, the stylesheet will not be loaded during page load.
@ -36,7 +41,7 @@ class CSSLinkHtmlTagAttributes {
///Incorrectly using it may cause the stylesheet to be ignored.
String? title;
CSSLinkHtmlTagAttributes(
CSSLinkHtmlTagAttributes_(
{this.id,
this.media,
this.crossOrigin,
@ -45,28 +50,4 @@ class CSSLinkHtmlTagAttributes {
this.disabled,
this.alternate,
this.title});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"id": this.id,
"media": this.media,
"crossOrigin": this.crossOrigin?.toValue(),
"integrity": this.integrity,
"referrerPolicy": this.referrerPolicy?.toValue(),
"disabled": this.disabled,
"alternate": this.alternate,
"title": this.title,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,93 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'css_link_html_tag_attributes.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the possible CSS stylesheet `<link>` HTML attributes to be set used by [InAppWebViewController.injectCSSFileFromUrl].
class CSSLinkHtmlTagAttributes {
///The HTML [id] attribute is used to specify a unique id for the `<link>` HTML element.
String? id;
///This attribute specifies the media that the linked resource applies to. Its value must be a media type / media query.
///This attribute is mainly useful when linking to external stylesheets it allows the user agent to pick the best adapted one for the device it runs on.
String? media;
///Normal script elements pass minimal information to the `window.onerror` for scripts which do not pass the standard CORS checks.
///To allow error logging for sites which use a separate domain for static media, use this attribute.
CrossOrigin? crossOrigin;
///This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation.
String? integrity;
///Indicates which referrer to send when fetching the script, or resources fetched by the script.
ReferrerPolicy? referrerPolicy;
///The [disabled] Boolean attribute indicates whether or not the described stylesheet should be loaded and applied to the document.
///If [disabled] is specified in the HTML when it is loaded, the stylesheet will not be loaded during page load.
///Instead, the stylesheet will be loaded on-demand, if and when the [disabled] attribute is changed to `false` or removed.
///
///Setting the [disabled] property in the DOM causes the stylesheet to be removed from the document's `DocumentOrShadowRoot.styleSheets` list.
bool? disabled;
///Specify alternative style sheets.
bool? alternate;
///The title attribute has special semantics on the `<link>` element.
///When used on a `<link rel="stylesheet">` it defines a preferred or an alternate stylesheet.
///Incorrectly using it may cause the stylesheet to be ignored.
String? title;
CSSLinkHtmlTagAttributes(
{this.id,
this.media,
this.crossOrigin,
this.integrity,
this.referrerPolicy,
this.disabled,
this.alternate,
this.title});
///Gets a possible [CSSLinkHtmlTagAttributes] instance from a [Map] value.
static CSSLinkHtmlTagAttributes? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = CSSLinkHtmlTagAttributes(
id: map['id'],
media: map['media'],
crossOrigin: CrossOrigin.fromNativeValue(map['crossOrigin']),
integrity: map['integrity'],
referrerPolicy: ReferrerPolicy.fromNativeValue(map['referrerPolicy']),
disabled: map['disabled'],
alternate: map['alternate'],
title: map['title'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"id": id,
"media": media,
"crossOrigin": crossOrigin?.toNativeValue(),
"integrity": integrity,
"referrerPolicy": referrerPolicy?.toNativeValue(),
"disabled": disabled,
"alternate": alternate,
"title": title,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'CSSLinkHtmlTagAttributes{id: $id, media: $media, crossOrigin: $crossOrigin, integrity: $integrity, referrerPolicy: $referrerPolicy, disabled: $disabled, alternate: $alternate, title: $title}';
}
}

View File

@ -1,10 +1,15 @@
import 'dart:typed_data';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'custom_scheme_response.g.dart';
///Class representing the response returned by the [WebView.onLoadResourceWithCustomScheme] event.
///It allows to load a specific resource. The resource data must be encoded to `base64`.
class CustomSchemeResponse {
@ExchangeableObject()
class CustomSchemeResponse_ {
///Data enconded to 'base64'.
Uint8List data;
@ -14,27 +19,8 @@ class CustomSchemeResponse {
///Content-Encoding of the data, such as `utf-8`.
String contentEncoding;
CustomSchemeResponse(
CustomSchemeResponse_(
{required this.data,
required this.contentType,
this.contentEncoding = 'utf-8'});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
'contentType': contentType,
'contentEncoding': contentEncoding,
'data': data
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,56 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_scheme_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing the response returned by the [WebView.onLoadResourceWithCustomScheme] event.
///It allows to load a specific resource. The resource data must be encoded to `base64`.
class CustomSchemeResponse {
///Data enconded to 'base64'.
Uint8List data;
///Content-Type of the data, such as `image/png`.
String contentType;
///Content-Encoding of the data, such as `utf-8`.
String contentEncoding;
CustomSchemeResponse(
{required this.data,
required this.contentType,
this.contentEncoding = 'utf-8'});
///Gets a possible [CustomSchemeResponse] instance from a [Map] value.
static CustomSchemeResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = CustomSchemeResponse(
data: map['data'],
contentType: map['contentType'],
);
instance.contentEncoding = map['contentEncoding'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"contentType": contentType,
"contentEncoding": contentEncoding,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'CustomSchemeResponse{data: $data, contentType: $contentType, contentEncoding: $contentEncoding}';
}
}

View File

@ -1,56 +1,20 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'custom_tabs_share_state.g.dart';
///Class representing the share state that should be applied to the custom tab.
class CustomTabsShareState {
@ExchangeableEnum()
class CustomTabsShareState_ {
// ignore: unused_field
final int _value;
const CustomTabsShareState._internal(this._value);
///Set of all values of [CustomTabsShareState].
static final Set<CustomTabsShareState> values = [
CustomTabsShareState.SHARE_STATE_DEFAULT,
CustomTabsShareState.SHARE_STATE_ON,
CustomTabsShareState.SHARE_STATE_OFF,
].toSet();
///Gets a possible [CustomTabsShareState] instance from an [int] value.
static CustomTabsShareState? fromValue(int? value) {
if (value != null) {
try {
return CustomTabsShareState.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 "SHARE_STATE_ON";
case 2:
return "SHARE_STATE_OFF";
case 0:
default:
return "SHARE_STATE_DEFAULT";
}
}
const CustomTabsShareState_._internal(this._value);
///Applies the default share settings depending on the browser.
static const SHARE_STATE_DEFAULT = const CustomTabsShareState._internal(0);
static const SHARE_STATE_DEFAULT = const CustomTabsShareState_._internal(0);
///Shows a share option in the tab.
static const SHARE_STATE_ON = const CustomTabsShareState._internal(1);
static const SHARE_STATE_ON = const CustomTabsShareState_._internal(1);
///Explicitly does not show a share option in the tab.
static const SHARE_STATE_OFF = const CustomTabsShareState._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const SHARE_STATE_OFF = const CustomTabsShareState_._internal(2);
}

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'custom_tabs_share_state.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class representing the share state that should be applied to the custom tab.
class CustomTabsShareState {
final int _value;
final int _nativeValue;
const CustomTabsShareState._internal(this._value, this._nativeValue);
// ignore: unused_element
factory CustomTabsShareState._internalMultiPlatform(
int value, Function nativeValue) =>
CustomTabsShareState._internal(value, nativeValue());
///Applies the default share settings depending on the browser.
static const SHARE_STATE_DEFAULT = CustomTabsShareState._internal(0, 0);
///Shows a share option in the tab.
static const SHARE_STATE_ON = CustomTabsShareState._internal(1, 1);
///Explicitly does not show a share option in the tab.
static const SHARE_STATE_OFF = CustomTabsShareState._internal(2, 2);
///Set of all values of [CustomTabsShareState].
static final Set<CustomTabsShareState> values = [
CustomTabsShareState.SHARE_STATE_DEFAULT,
CustomTabsShareState.SHARE_STATE_ON,
CustomTabsShareState.SHARE_STATE_OFF,
].toSet();
///Gets a possible [CustomTabsShareState] instance from [int] value.
static CustomTabsShareState? fromValue(int? value) {
if (value != null) {
try {
return CustomTabsShareState.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [CustomTabsShareState] instance from a native value.
static CustomTabsShareState? fromNativeValue(int? value) {
if (value != null) {
try {
return CustomTabsShareState.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 'SHARE_STATE_DEFAULT';
case 1:
return 'SHARE_STATE_ON';
case 2:
return 'SHARE_STATE_OFF';
}
return _value.toString();
}
}

View File

@ -1,81 +1,48 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'data_detector_types.g.dart';
///Class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
class DataDetectorTypes {
@ExchangeableEnum()
class DataDetectorTypes_ {
// ignore: unused_field
final String _value;
const DataDetectorTypes._internal(this._value);
///Set of all values of [DataDetectorTypes].
static final Set<DataDetectorTypes> values = [
DataDetectorTypes.NONE,
DataDetectorTypes.PHONE_NUMBER,
DataDetectorTypes.LINK,
DataDetectorTypes.ADDRESS,
DataDetectorTypes.CALENDAR_EVENT,
DataDetectorTypes.TRACKING_NUMBER,
DataDetectorTypes.FLIGHT_NUMBER,
DataDetectorTypes.LOOKUP_SUGGESTION,
DataDetectorTypes.SPOTLIGHT_SUGGESTION,
DataDetectorTypes.ALL,
].toSet();
///Gets a possible [DataDetectorTypes] instance from a [String] value.
static DataDetectorTypes? fromValue(String? value) {
if (value != null) {
try {
return DataDetectorTypes.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const DataDetectorTypes_._internal(this._value);
///No detection is performed.
static const NONE = const DataDetectorTypes._internal("NONE");
static const NONE = const DataDetectorTypes_._internal("NONE");
///Phone numbers are detected and turned into links.
static const PHONE_NUMBER = const DataDetectorTypes._internal("PHONE_NUMBER");
static const PHONE_NUMBER = const DataDetectorTypes_._internal("PHONE_NUMBER");
///URLs in text are detected and turned into links.
static const LINK = const DataDetectorTypes._internal("LINK");
static const LINK = const DataDetectorTypes_._internal("LINK");
///Addresses are detected and turned into links.
static const ADDRESS = const DataDetectorTypes._internal("ADDRESS");
static const ADDRESS = const DataDetectorTypes_._internal("ADDRESS");
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
const DataDetectorTypes._internal("CALENDAR_EVENT");
const DataDetectorTypes_._internal("CALENDAR_EVENT");
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
const DataDetectorTypes._internal("TRACKING_NUMBER");
const DataDetectorTypes_._internal("TRACKING_NUMBER");
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
const DataDetectorTypes._internal("FLIGHT_NUMBER");
const DataDetectorTypes_._internal("FLIGHT_NUMBER");
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
const DataDetectorTypes._internal("LOOKUP_SUGGESTION");
const DataDetectorTypes_._internal("LOOKUP_SUGGESTION");
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION =
const DataDetectorTypes._internal("SPOTLIGHT_SUGGESTION");
const DataDetectorTypes_._internal("SPOTLIGHT_SUGGESTION");
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
static const ALL = const DataDetectorTypes._internal("ALL");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const ALL = const DataDetectorTypes_._internal("ALL");
}
///An iOS-specific class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
@ -84,82 +51,45 @@ class DataDetectorTypes {
///
///Use [DataDetectorTypes] instead.
@Deprecated("Use DataDetectorTypes instead")
class IOSWKDataDetectorTypes {
@ExchangeableEnum()
class IOSWKDataDetectorTypes_ {
// ignore: unused_field
final String _value;
const IOSWKDataDetectorTypes._internal(this._value);
///Set of all values of [IOSWKDataDetectorTypes].
static final Set<IOSWKDataDetectorTypes> values = [
IOSWKDataDetectorTypes.NONE,
IOSWKDataDetectorTypes.PHONE_NUMBER,
IOSWKDataDetectorTypes.LINK,
IOSWKDataDetectorTypes.ADDRESS,
IOSWKDataDetectorTypes.CALENDAR_EVENT,
IOSWKDataDetectorTypes.TRACKING_NUMBER,
IOSWKDataDetectorTypes.FLIGHT_NUMBER,
IOSWKDataDetectorTypes.LOOKUP_SUGGESTION,
IOSWKDataDetectorTypes.SPOTLIGHT_SUGGESTION,
IOSWKDataDetectorTypes.ALL,
].toSet();
///Gets a possible [IOSWKDataDetectorTypes] instance from a [String] value.
static IOSWKDataDetectorTypes? fromValue(String? value) {
if (value != null) {
try {
return IOSWKDataDetectorTypes.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const IOSWKDataDetectorTypes_._internal(this._value);
///No detection is performed.
static const NONE = const IOSWKDataDetectorTypes._internal("NONE");
static const NONE = const IOSWKDataDetectorTypes_._internal("NONE");
///Phone numbers are detected and turned into links.
static const PHONE_NUMBER =
const IOSWKDataDetectorTypes._internal("PHONE_NUMBER");
const IOSWKDataDetectorTypes_._internal("PHONE_NUMBER");
///URLs in text are detected and turned into links.
static const LINK = const IOSWKDataDetectorTypes._internal("LINK");
static const LINK = const IOSWKDataDetectorTypes_._internal("LINK");
///Addresses are detected and turned into links.
static const ADDRESS = const IOSWKDataDetectorTypes._internal("ADDRESS");
static const ADDRESS = const IOSWKDataDetectorTypes_._internal("ADDRESS");
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
const IOSWKDataDetectorTypes._internal("CALENDAR_EVENT");
const IOSWKDataDetectorTypes_._internal("CALENDAR_EVENT");
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
const IOSWKDataDetectorTypes._internal("TRACKING_NUMBER");
const IOSWKDataDetectorTypes_._internal("TRACKING_NUMBER");
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
const IOSWKDataDetectorTypes._internal("FLIGHT_NUMBER");
const IOSWKDataDetectorTypes_._internal("FLIGHT_NUMBER");
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
const IOSWKDataDetectorTypes._internal("LOOKUP_SUGGESTION");
const IOSWKDataDetectorTypes_._internal("LOOKUP_SUGGESTION");
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION =
const IOSWKDataDetectorTypes._internal("SPOTLIGHT_SUGGESTION");
const IOSWKDataDetectorTypes_._internal("SPOTLIGHT_SUGGESTION");
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
static const ALL = const IOSWKDataDetectorTypes._internal("ALL");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const ALL = const IOSWKDataDetectorTypes_._internal("ALL");
}

View File

@ -0,0 +1,220 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'data_detector_types.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
class DataDetectorTypes {
final String _value;
final String _nativeValue;
const DataDetectorTypes._internal(this._value, this._nativeValue);
// ignore: unused_element
factory DataDetectorTypes._internalMultiPlatform(
String value, Function nativeValue) =>
DataDetectorTypes._internal(value, nativeValue());
///No detection is performed.
static const NONE = DataDetectorTypes._internal('NONE', 'NONE');
///Phone numbers are detected and turned into links.
static const PHONE_NUMBER =
DataDetectorTypes._internal('PHONE_NUMBER', 'PHONE_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = DataDetectorTypes._internal('LINK', 'LINK');
///Addresses are detected and turned into links.
static const ADDRESS = DataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
DataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
DataDetectorTypes._internal('TRACKING_NUMBER', 'TRACKING_NUMBER');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
DataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION =
DataDetectorTypes._internal('LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = DataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', 'SPOTLIGHT_SUGGESTION');
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
static const ALL = DataDetectorTypes._internal('ALL', 'ALL');
///Set of all values of [DataDetectorTypes].
static final Set<DataDetectorTypes> values = [
DataDetectorTypes.NONE,
DataDetectorTypes.PHONE_NUMBER,
DataDetectorTypes.LINK,
DataDetectorTypes.ADDRESS,
DataDetectorTypes.CALENDAR_EVENT,
DataDetectorTypes.TRACKING_NUMBER,
DataDetectorTypes.FLIGHT_NUMBER,
DataDetectorTypes.LOOKUP_SUGGESTION,
DataDetectorTypes.SPOTLIGHT_SUGGESTION,
DataDetectorTypes.ALL,
].toSet();
///Gets a possible [DataDetectorTypes] instance from [String] value.
static DataDetectorTypes? fromValue(String? value) {
if (value != null) {
try {
return DataDetectorTypes.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [DataDetectorTypes] instance from a native value.
static DataDetectorTypes? fromNativeValue(String? value) {
if (value != null) {
try {
return DataDetectorTypes.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;
}
}
///An iOS-specific class used to specify a `dataDetectoryTypes` value that adds interactivity to web content that matches the value.
///
///**NOTE**: available on iOS 10.0+.
///
///Use [DataDetectorTypes] instead.
@Deprecated('Use DataDetectorTypes instead')
class IOSWKDataDetectorTypes {
final String _value;
final String _nativeValue;
const IOSWKDataDetectorTypes._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSWKDataDetectorTypes._internalMultiPlatform(
String value, Function nativeValue) =>
IOSWKDataDetectorTypes._internal(value, nativeValue());
///No detection is performed.
static const NONE = IOSWKDataDetectorTypes._internal('NONE', 'NONE');
///Phone numbers are detected and turned into links.
static const PHONE_NUMBER =
IOSWKDataDetectorTypes._internal('PHONE_NUMBER', 'PHONE_NUMBER');
///URLs in text are detected and turned into links.
static const LINK = IOSWKDataDetectorTypes._internal('LINK', 'LINK');
///Addresses are detected and turned into links.
static const ADDRESS = IOSWKDataDetectorTypes._internal('ADDRESS', 'ADDRESS');
///Dates and times that are in the future are detected and turned into links.
static const CALENDAR_EVENT =
IOSWKDataDetectorTypes._internal('CALENDAR_EVENT', 'CALENDAR_EVENT');
///Tracking numbers are detected and turned into links.
static const TRACKING_NUMBER =
IOSWKDataDetectorTypes._internal('TRACKING_NUMBER', 'TRACKING_NUMBER');
///Flight numbers are detected and turned into links.
static const FLIGHT_NUMBER =
IOSWKDataDetectorTypes._internal('FLIGHT_NUMBER', 'FLIGHT_NUMBER');
///Lookup suggestions are detected and turned into links.
static const LOOKUP_SUGGESTION = IOSWKDataDetectorTypes._internal(
'LOOKUP_SUGGESTION', 'LOOKUP_SUGGESTION');
///Spotlight suggestions are detected and turned into links.
static const SPOTLIGHT_SUGGESTION = IOSWKDataDetectorTypes._internal(
'SPOTLIGHT_SUGGESTION', 'SPOTLIGHT_SUGGESTION');
///All of the above data types are turned into links when detected. Choosing this value will automatically include any new detection type that is added.
static const ALL = IOSWKDataDetectorTypes._internal('ALL', 'ALL');
///Set of all values of [IOSWKDataDetectorTypes].
static final Set<IOSWKDataDetectorTypes> values = [
IOSWKDataDetectorTypes.NONE,
IOSWKDataDetectorTypes.PHONE_NUMBER,
IOSWKDataDetectorTypes.LINK,
IOSWKDataDetectorTypes.ADDRESS,
IOSWKDataDetectorTypes.CALENDAR_EVENT,
IOSWKDataDetectorTypes.TRACKING_NUMBER,
IOSWKDataDetectorTypes.FLIGHT_NUMBER,
IOSWKDataDetectorTypes.LOOKUP_SUGGESTION,
IOSWKDataDetectorTypes.SPOTLIGHT_SUGGESTION,
IOSWKDataDetectorTypes.ALL,
].toSet();
///Gets a possible [IOSWKDataDetectorTypes] instance from [String] value.
static IOSWKDataDetectorTypes? fromValue(String? value) {
if (value != null) {
try {
return IOSWKDataDetectorTypes.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSWKDataDetectorTypes] instance from a native value.
static IOSWKDataDetectorTypes? fromNativeValue(String? value) {
if (value != null) {
try {
return IOSWKDataDetectorTypes.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,58 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'dismiss_button_style.g.dart';
///Class used to set the custom style for the dismiss button.
class DismissButtonStyle {
@ExchangeableEnum()
class DismissButtonStyle_ {
// ignore: unused_field
final int _value;
const DismissButtonStyle._internal(this._value);
///Set of all values of [DismissButtonStyle].
static final Set<DismissButtonStyle> values = [
DismissButtonStyle.DONE,
DismissButtonStyle.CLOSE,
DismissButtonStyle.CANCEL,
].toSet();
///Gets a possible [DismissButtonStyle] instance from an [int] value.
static DismissButtonStyle? fromValue(int? value) {
if (value != null) {
try {
return DismissButtonStyle.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 "CLOSE";
case 2:
return "CANCEL";
case 0:
default:
return "DONE";
}
}
const DismissButtonStyle_._internal(this._value);
///Makes the button title the localized string "Done".
static const DONE = const DismissButtonStyle._internal(0);
static const DONE = const DismissButtonStyle_._internal(0);
///Makes the button title the localized string "Close".
static const CLOSE = const DismissButtonStyle._internal(1);
static const CLOSE = const DismissButtonStyle_._internal(1);
///Makes the button title the localized string "Cancel".
static const CANCEL = const DismissButtonStyle._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CANCEL = const DismissButtonStyle_._internal(2);
}
///An iOS-specific class used to set the custom style for the dismiss button.
@ -61,58 +25,18 @@ class DismissButtonStyle {
///
///Use [DismissButtonStyle] instead.
@Deprecated("Use DismissButtonStyle instead")
class IOSSafariDismissButtonStyle {
@ExchangeableEnum()
class IOSSafariDismissButtonStyle_ {
// ignore: unused_field
final int _value;
const IOSSafariDismissButtonStyle._internal(this._value);
///Set of all values of [IOSSafariDismissButtonStyle].
static final Set<IOSSafariDismissButtonStyle> values = [
IOSSafariDismissButtonStyle.DONE,
IOSSafariDismissButtonStyle.CLOSE,
IOSSafariDismissButtonStyle.CANCEL,
].toSet();
///Gets a possible [IOSSafariDismissButtonStyle] instance from an [int] value.
static IOSSafariDismissButtonStyle? fromValue(int? value) {
if (value != null) {
try {
return IOSSafariDismissButtonStyle.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 "CLOSE";
case 2:
return "CANCEL";
case 0:
default:
return "DONE";
}
}
const IOSSafariDismissButtonStyle_._internal(this._value);
///Makes the button title the localized string "Done".
static const DONE = const IOSSafariDismissButtonStyle._internal(0);
static const DONE = const IOSSafariDismissButtonStyle_._internal(0);
///Makes the button title the localized string "Close".
static const CLOSE = const IOSSafariDismissButtonStyle._internal(1);
static const CLOSE = const IOSSafariDismissButtonStyle_._internal(1);
///Makes the button title the localized string "Cancel".
static const CANCEL = const IOSSafariDismissButtonStyle._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CANCEL = const IOSSafariDismissButtonStyle_._internal(2);
}

View File

@ -0,0 +1,168 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'dismiss_button_style.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to set the custom style for the dismiss button.
class DismissButtonStyle {
final int _value;
final int _nativeValue;
const DismissButtonStyle._internal(this._value, this._nativeValue);
// ignore: unused_element
factory DismissButtonStyle._internalMultiPlatform(
int value, Function nativeValue) =>
DismissButtonStyle._internal(value, nativeValue());
///Makes the button title the localized string "Done".
static const DONE = DismissButtonStyle._internal(0, 0);
///Makes the button title the localized string "Close".
static const CLOSE = DismissButtonStyle._internal(1, 1);
///Makes the button title the localized string "Cancel".
static const CANCEL = DismissButtonStyle._internal(2, 2);
///Set of all values of [DismissButtonStyle].
static final Set<DismissButtonStyle> values = [
DismissButtonStyle.DONE,
DismissButtonStyle.CLOSE,
DismissButtonStyle.CANCEL,
].toSet();
///Gets a possible [DismissButtonStyle] instance from [int] value.
static DismissButtonStyle? fromValue(int? value) {
if (value != null) {
try {
return DismissButtonStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [DismissButtonStyle] instance from a native value.
static DismissButtonStyle? fromNativeValue(int? value) {
if (value != null) {
try {
return DismissButtonStyle.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 'DONE';
case 1:
return 'CLOSE';
case 2:
return 'CANCEL';
}
return _value.toString();
}
}
///An iOS-specific class used to set the custom style for the dismiss button.
///
///**NOTE**: available on iOS 11.0+.
///
///Use [DismissButtonStyle] instead.
@Deprecated('Use DismissButtonStyle instead')
class IOSSafariDismissButtonStyle {
final int _value;
final int _nativeValue;
const IOSSafariDismissButtonStyle._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSSafariDismissButtonStyle._internalMultiPlatform(
int value, Function nativeValue) =>
IOSSafariDismissButtonStyle._internal(value, nativeValue());
///Makes the button title the localized string "Done".
static const DONE = IOSSafariDismissButtonStyle._internal(0, 0);
///Makes the button title the localized string "Close".
static const CLOSE = IOSSafariDismissButtonStyle._internal(1, 1);
///Makes the button title the localized string "Cancel".
static const CANCEL = IOSSafariDismissButtonStyle._internal(2, 2);
///Set of all values of [IOSSafariDismissButtonStyle].
static final Set<IOSSafariDismissButtonStyle> values = [
IOSSafariDismissButtonStyle.DONE,
IOSSafariDismissButtonStyle.CLOSE,
IOSSafariDismissButtonStyle.CANCEL,
].toSet();
///Gets a possible [IOSSafariDismissButtonStyle] instance from [int] value.
static IOSSafariDismissButtonStyle? fromValue(int? value) {
if (value != null) {
try {
return IOSSafariDismissButtonStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSSafariDismissButtonStyle] instance from a native value.
static IOSSafariDismissButtonStyle? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSSafariDismissButtonStyle.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 'DONE';
case 1:
return 'CLOSE';
case 2:
return 'CANCEL';
}
return _value.toString();
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'download_start_request.g.dart';
///Class representing a download request of the WebView used by the event [WebView.onDownloadStartRequest].
class DownloadStartRequest {
@ExchangeableObject()
class DownloadStartRequest_ {
///The full url to the content that should be downloaded.
Uri url;
@ -23,7 +28,7 @@ class DownloadStartRequest {
///The name of the text encoding of the receiver, or `null` if no text encoding was specified.
String? textEncodingName;
DownloadStartRequest(
DownloadStartRequest_(
{required this.url,
this.userAgent,
this.contentDisposition,
@ -31,43 +36,4 @@ class DownloadStartRequest {
required this.contentLength,
this.suggestedFilename,
this.textEncodingName});
///Gets a possible [DownloadStartRequest] instance from a [Map] value.
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return DownloadStartRequest(
url: Uri.parse(map["url"]),
userAgent: map["userAgent"],
contentDisposition: map["contentDisposition"],
mimeType: map["mimeType"],
contentLength: map["contentLength"],
suggestedFilename: map["suggestedFilename"],
textEncodingName: map["textEncodingName"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"userAgent": userAgent,
"contentDisposition": contentDisposition,
"mimeType": mimeType,
"contentLength": contentLength,
"suggestedFilename": suggestedFilename,
"textEncodingName": textEncodingName
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'download_start_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing a download request of the WebView used by the event [WebView.onDownloadStartRequest].
class DownloadStartRequest {
///The full url to the content that should be downloaded.
Uri url;
///the user agent to be used for the download.
String? userAgent;
///Content-disposition http header, if present.
String? contentDisposition;
///The mimetype of the content reported by the server.
String? mimeType;
///The file size reported by the server.
int contentLength;
///A suggested filename to use if saving the resource to disk.
String? suggestedFilename;
///The name of the text encoding of the receiver, or `null` if no text encoding was specified.
String? textEncodingName;
DownloadStartRequest(
{required this.url,
this.userAgent,
this.contentDisposition,
this.mimeType,
required this.contentLength,
this.suggestedFilename,
this.textEncodingName});
///Gets a possible [DownloadStartRequest] instance from a [Map] value.
static DownloadStartRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = DownloadStartRequest(
url: Uri.parse(map['url']),
userAgent: map['userAgent'],
contentDisposition: map['contentDisposition'],
mimeType: map['mimeType'],
contentLength: map['contentLength'],
suggestedFilename: map['suggestedFilename'],
textEncodingName: map['textEncodingName'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"userAgent": userAgent,
"contentDisposition": contentDisposition,
"mimeType": mimeType,
"contentLength": contentLength,
"suggestedFilename": suggestedFilename,
"textEncodingName": textEncodingName,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'DownloadStartRequest{url: $url, userAgent: $userAgent, contentDisposition: $contentDisposition, mimeType: $mimeType, contentLength: $contentLength, suggestedFilename: $suggestedFilename, textEncodingName: $textEncodingName}';
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_controller.dart';
part 'favicon.g.dart';
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
class Favicon {
@ExchangeableObject()
class Favicon_ {
///The url of the favicon image.
Uri url;
@ -14,25 +19,5 @@ class Favicon {
///The height of the favicon image.
int? height;
Favicon({required this.url, this.rel, this.width, this.height});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"rel": rel,
"width": width,
"height": height
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
Favicon_({required this.url, this.rel, this.width, this.height});
}

View File

@ -0,0 +1,57 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'favicon.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a favicon of a website. It is used by [InAppWebViewController.getFavicons] method.
class Favicon {
///The url of the favicon image.
Uri url;
///The relationship between the current web page and the favicon image.
String? rel;
///The width of the favicon image.
int? width;
///The height of the favicon image.
int? height;
Favicon({required this.url, this.rel, this.width, this.height});
///Gets a possible [Favicon] instance from a [Map] value.
static Favicon? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = Favicon(
url: Uri.parse(map['url']),
rel: map['rel'],
width: map['width'],
height: map['height'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url.toString(),
"rel": rel,
"width": width,
"height": height,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'Favicon{url: $url, rel: $rel, width: $width, height: $height}';
}
}

View File

@ -1,3 +1,5 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request_action.dart';
import 'fetch_request_credential.dart';
import 'fetch_request_credential_default.dart';
@ -5,8 +7,26 @@ import 'fetch_request_federated_credential.dart';
import 'fetch_request_password_credential.dart';
import 'referrer_policy.dart';
part 'fetch_request.g.dart';
FetchRequestCredential? _fetchRequestCredentialDeserializer(dynamic value) {
Map<String, dynamic>? credentialMap = value?.cast<String, dynamic>();
FetchRequestCredential? credentials;
if (credentialMap != null) {
if (credentialMap["type"] == "default") {
credentials = FetchRequestCredentialDefault.fromMap(credentialMap);
} else if (credentialMap["type"] == "federated") {
credentials = FetchRequestFederatedCredential.fromMap(credentialMap);
} else if (credentialMap["type"] == "password") {
credentials = FetchRequestPasswordCredential.fromMap(credentialMap);
}
}
return credentials;
}
///Class that represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
class FetchRequest {
@ExchangeableObject()
class FetchRequest_ {
///The URL of the request.
Uri? url;
@ -23,7 +43,10 @@ class FetchRequest {
String? mode;
///The request credentials used by the request.
FetchRequestCredential? credentials;
@ExchangeableObjectProperty(
deserializer: _fetchRequestCredentialDeserializer
)
FetchRequestCredential_? credentials;
///The cache mode used by the request.
String? cache;
@ -35,7 +58,7 @@ class FetchRequest {
String? referrer;
///The value of the referer HTTP header.
ReferrerPolicy? referrerPolicy;
ReferrerPolicy_? referrerPolicy;
///Contains the subresource integrity value of the request.
String? integrity;
@ -44,9 +67,9 @@ class FetchRequest {
bool? keepalive;
///Indicates the [FetchRequestAction] that can be used to control the request.
FetchRequestAction? action;
FetchRequestAction_? action;
FetchRequest(
FetchRequest_(
{this.url,
this.method,
this.headers,
@ -59,68 +82,5 @@ class FetchRequest {
this.referrerPolicy,
this.integrity,
this.keepalive,
this.action = FetchRequestAction.PROCEED});
///Gets a possible [FetchRequest] instance from a [Map] value.
static FetchRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
Map<String, dynamic>? credentialMap =
map["credentials"]?.cast<String, dynamic>();
FetchRequestCredential? credentials;
if (credentialMap != null) {
if (credentialMap["type"] == "default") {
credentials = FetchRequestCredentialDefault.fromMap(credentialMap);
} else if (credentialMap["type"] == "federated") {
credentials = FetchRequestFederatedCredential.fromMap(credentialMap);
} else if (credentialMap["type"] == "password") {
credentials = FetchRequestPasswordCredential.fromMap(credentialMap);
}
}
return FetchRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
method: map["method"],
headers: map["headers"]?.cast<String, dynamic>(),
body: map["body"],
mode: map["mode"],
credentials: credentials,
cache: map["cache"],
redirect: map["redirect"],
referrer: map["referrer"],
referrerPolicy: ReferrerPolicy.fromValue(map["referrerPolicy"]),
integrity: map["integrity"],
keepalive: map["keepalive"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"method": method,
"headers": headers,
"body": body,
"mode": mode,
"credentials": credentials?.toMap(),
"cache": cache,
"redirect": redirect,
"referrer": referrer,
"referrerPolicy": referrerPolicy?.toValue(),
"integrity": integrity,
"keepalive": keepalive,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = FetchRequestAction_.PROCEED});
}

View File

@ -0,0 +1,115 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a HTTP request created with JavaScript using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch).
class FetchRequest {
///The URL of the request.
Uri? url;
///The HTTP request method used of the request.
String? method;
///The HTTP request headers.
Map<String, dynamic>? headers;
///Body of the request.
dynamic body;
///The mode used by the request.
String? mode;
///The request credentials used by the request.
FetchRequestCredential? credentials;
///The cache mode used by the request.
String? cache;
///The redirect mode used by the request.
String? redirect;
///A String specifying no-referrer, client, or a URL.
String? referrer;
///The value of the referer HTTP header.
ReferrerPolicy? referrerPolicy;
///Contains the subresource integrity value of the request.
String? integrity;
///The keepalive option used to allow the request to outlive the page.
bool? keepalive;
///Indicates the [FetchRequestAction] that can be used to control the request.
FetchRequestAction? action;
FetchRequest(
{this.url,
this.method,
this.headers,
this.body,
this.mode,
this.credentials,
this.cache,
this.redirect,
this.referrer,
this.referrerPolicy,
this.integrity,
this.keepalive,
this.action = FetchRequestAction.PROCEED});
///Gets a possible [FetchRequest] instance from a [Map] value.
static FetchRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FetchRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
method: map['method'],
headers: map['headers'],
body: map['body'],
mode: map['mode'],
credentials: _fetchRequestCredentialDeserializer(map['credentials']),
cache: map['cache'],
redirect: map['redirect'],
referrer: map['referrer'],
referrerPolicy: ReferrerPolicy.fromNativeValue(map['referrerPolicy']),
integrity: map['integrity'],
keepalive: map['keepalive'],
);
instance.action = FetchRequestAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"method": method,
"headers": headers,
"body": body,
"mode": mode,
"credentials": credentials?.toMap(),
"cache": cache,
"redirect": redirect,
"referrer": referrer,
"referrerPolicy": referrerPolicy?.toNativeValue(),
"integrity": integrity,
"keepalive": keepalive,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FetchRequest{url: $url, method: $method, headers: $headers, body: $body, mode: $mode, credentials: $credentials, cache: $cache, redirect: $redirect, referrer: $referrer, referrerPolicy: $referrerPolicy, integrity: $integrity, keepalive: $keepalive, action: $action}';
}
}

View File

@ -1,22 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request.dart';
part 'fetch_request_action.g.dart';
///Class used by [FetchRequest] class.
class FetchRequestAction {
@ExchangeableEnum()
class FetchRequestAction_ {
// ignore: unused_field
final int _value;
const FetchRequestAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const FetchRequestAction_._internal(this._value);
///Aborts the fetch request.
static const ABORT = const FetchRequestAction._internal(0);
static const ABORT = const FetchRequestAction_._internal(0);
///Proceeds with the fetch request.
static const PROCEED = const FetchRequestAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const PROCEED = const FetchRequestAction_._internal(1);
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [FetchRequest] class.
class FetchRequestAction {
final int _value;
final int _nativeValue;
const FetchRequestAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory FetchRequestAction._internalMultiPlatform(
int value, Function nativeValue) =>
FetchRequestAction._internal(value, nativeValue());
///Aborts the fetch request.
static const ABORT = FetchRequestAction._internal(0, 0);
///Proceeds with the fetch request.
static const PROCEED = FetchRequestAction._internal(1, 1);
///Set of all values of [FetchRequestAction].
static final Set<FetchRequestAction> values = [
FetchRequestAction.ABORT,
FetchRequestAction.PROCEED,
].toSet();
///Gets a possible [FetchRequestAction] instance from [int] value.
static FetchRequestAction? fromValue(int? value) {
if (value != null) {
try {
return FetchRequestAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [FetchRequestAction] instance from a native value.
static FetchRequestAction? fromNativeValue(int? value) {
if (value != null) {
try {
return FetchRequestAction.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 'ABORT';
case 1:
return 'PROCEED';
}
return _value.toString();
}
}

View File

@ -1,34 +1,16 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request_credential_default.dart';
import 'fetch_request_federated_credential.dart';
import 'fetch_request_password_credential.dart';
part 'fetch_request_credential.g.dart';
///Class that is an interface for [FetchRequestCredentialDefault], [FetchRequestFederatedCredential] and [FetchRequestPasswordCredential] classes.
class FetchRequestCredential {
@ExchangeableObject()
class FetchRequestCredential_ {
///Type of credentials.
String? type;
FetchRequestCredential({this.type});
///Gets a possible [FetchRequestCredential] instance from a [Map] value.
static FetchRequestCredential? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return FetchRequestCredential(type: map["type"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"type": type};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
FetchRequestCredential_({this.type});
}

View File

@ -0,0 +1,42 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request_credential.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that is an interface for [FetchRequestCredentialDefault], [FetchRequestFederatedCredential] and [FetchRequestPasswordCredential] classes.
class FetchRequestCredential {
///Type of credentials.
String? type;
FetchRequestCredential({this.type});
///Gets a possible [FetchRequestCredential] instance from a [Map] value.
static FetchRequestCredential? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FetchRequestCredential(
type: map['type'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FetchRequestCredential{type: $type}';
}
}

View File

@ -1,38 +1,15 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request.dart';
import 'fetch_request_credential.dart';
part 'fetch_request_credential_default.g.dart';
///Class that represents the default credentials used by an [FetchRequest].
class FetchRequestCredentialDefault extends FetchRequestCredential {
@ExchangeableObject()
class FetchRequestCredentialDefault_ extends FetchRequestCredential_ {
///The value of the credentials.
String? value;
FetchRequestCredentialDefault({type, this.value}) : super(type: type);
///Gets a possible [FetchRequestCredentialDefault] instance from a [Map] value.
static FetchRequestCredentialDefault? fromMap(
Map<String, dynamic>? credentialsMap) {
if (credentialsMap == null) {
return null;
}
return FetchRequestCredentialDefault(
type: credentialsMap["type"], value: credentialsMap["value"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"value": value,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
FetchRequestCredentialDefault_({type, this.value}) : super(type: type);
}

View File

@ -0,0 +1,44 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request_credential_default.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the default credentials used by an [FetchRequest].
class FetchRequestCredentialDefault extends FetchRequestCredential {
///The value of the credentials.
String? value;
FetchRequestCredentialDefault({this.value, String? type}) : super(type: type);
///Gets a possible [FetchRequestCredentialDefault] instance from a [Map] value.
static FetchRequestCredentialDefault? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FetchRequestCredentialDefault(
value: map['value'],
);
instance.type = map['type'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"value": value,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FetchRequestCredentialDefault{type: $type, value: $value}';
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request_credential.dart';
part 'fetch_request_federated_credential.g.dart';
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
class FetchRequestFederatedCredential extends FetchRequestCredential {
@ExchangeableObject()
class FetchRequestFederatedCredential_ extends FetchRequestCredential_ {
///Credential's identifier.
dynamic id;
@ -17,46 +22,7 @@ class FetchRequestFederatedCredential extends FetchRequestCredential {
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
Uri? iconURL;
FetchRequestFederatedCredential(
FetchRequestFederatedCredential_(
{type, this.id, this.name, this.protocol, this.provider, this.iconURL})
: super(type: type);
///Gets a possible [FetchRequestFederatedCredential] instance from a [Map] value.
static FetchRequestFederatedCredential? fromMap(
Map<String, dynamic>? credentialsMap) {
if (credentialsMap == null) {
return null;
}
return FetchRequestFederatedCredential(
type: credentialsMap["type"],
id: credentialsMap["id"],
name: credentialsMap["name"],
protocol: credentialsMap["protocol"],
provider: credentialsMap["provider"],
iconURL: credentialsMap["iconURL"] != null
? Uri.parse(credentialsMap["iconURL"])
: null);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"id": id,
"name": name,
"protocol": protocol,
"provider": provider,
"iconURL": iconURL?.toString()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,71 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request_federated_credential.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a [FederatedCredential](https://developer.mozilla.org/en-US/docs/Web/API/FederatedCredential) type of credentials.
class FetchRequestFederatedCredential extends FetchRequestCredential {
///Credential's identifier.
dynamic id;
///The name associated with a credential. It should be a human-readable, public name.
String? name;
///Credential's federated identity protocol.
String? protocol;
///Credential's federated identity provider.
String? provider;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
Uri? iconURL;
FetchRequestFederatedCredential(
{this.id,
this.name,
this.protocol,
this.provider,
this.iconURL,
String? type})
: super(type: type);
///Gets a possible [FetchRequestFederatedCredential] instance from a [Map] value.
static FetchRequestFederatedCredential? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FetchRequestFederatedCredential(
id: map['id'],
name: map['name'],
protocol: map['protocol'],
provider: map['provider'],
iconURL: map['iconURL'] != null ? Uri.parse(map['iconURL']) : null,
);
instance.type = map['type'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"id": id,
"name": name,
"protocol": protocol,
"provider": provider,
"iconURL": iconURL?.toString(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FetchRequestFederatedCredential{type: $type, id: $id, name: $name, protocol: $protocol, provider: $provider, iconURL: $iconURL}';
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'fetch_request_credential.dart';
part 'fetch_request_password_credential.g.dart';
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
class FetchRequestPasswordCredential extends FetchRequestCredential {
@ExchangeableObject()
class FetchRequestPasswordCredential_ extends FetchRequestCredential_ {
///Credential's identifier.
dynamic id;
@ -14,44 +19,7 @@ class FetchRequestPasswordCredential extends FetchRequestCredential {
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
Uri? iconURL;
FetchRequestPasswordCredential(
FetchRequestPasswordCredential_(
{type, this.id, this.name, this.password, this.iconURL})
: super(type: type);
///Gets a possible [FetchRequestPasswordCredential] instance from a [Map] value.
static FetchRequestPasswordCredential? fromMap(
Map<String, dynamic>? credentialsMap) {
if (credentialsMap == null) {
return null;
}
return FetchRequestPasswordCredential(
type: credentialsMap["type"],
id: credentialsMap["id"],
name: credentialsMap["name"],
password: credentialsMap["password"],
iconURL: credentialsMap["iconURL"] != null
? Uri.parse(credentialsMap["iconURL"])
: null);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"id": id,
"name": name,
"password": password,
"iconURL": iconURL?.toString()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,61 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'fetch_request_password_credential.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a [PasswordCredential](https://developer.mozilla.org/en-US/docs/Web/API/PasswordCredential) type of credentials.
class FetchRequestPasswordCredential extends FetchRequestCredential {
///Credential's identifier.
dynamic id;
///The name associated with a credential. It should be a human-readable, public name.
String? name;
///The password of the credential.
String? password;
///URL pointing to an image for an icon. This image is intended for display in a credential chooser. The URL must be accessible without authentication.
Uri? iconURL;
FetchRequestPasswordCredential(
{this.id, this.name, this.password, this.iconURL, String? type})
: super(type: type);
///Gets a possible [FetchRequestPasswordCredential] instance from a [Map] value.
static FetchRequestPasswordCredential? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = FetchRequestPasswordCredential(
id: map['id'],
name: map['name'],
password: map['password'],
iconURL: map['iconURL'] != null ? Uri.parse(map['iconURL']) : null,
);
instance.type = map['type'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type,
"id": id,
"name": name,
"password": password,
"iconURL": iconURL?.toString(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'FetchRequestPasswordCredential{type: $type, id: $id, name: $name, password: $password, iconURL: $iconURL}';
}
}

View File

@ -1,59 +1,23 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'force_dark.g.dart';
///Class used to indicate the force dark mode.
class ForceDark {
@ExchangeableEnum()
class ForceDark_ {
// ignore: unused_field
final int _value;
const ForceDark._internal(this._value);
///Set of all values of [ForceDark].
static final Set<ForceDark> values = [
ForceDark.OFF,
ForceDark.AUTO,
ForceDark.ON,
].toSet();
///Gets a possible [ForceDark] instance from an [int] value.
static ForceDark? fromValue(int? value) {
if (value != null) {
try {
return ForceDark.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 "AUTO";
case 2:
return "ON";
case 0:
default:
return "OFF";
}
}
const ForceDark_._internal(this._value);
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
static const OFF = const ForceDark._internal(0);
static const OFF = const ForceDark_._internal(0);
///Enable force dark dependent on the state of the WebView parent view.
static const AUTO = const ForceDark._internal(1);
static const AUTO = const ForceDark_._internal(1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const ON = const ForceDark._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const ON = const ForceDark_._internal(2);
}
///An Android-specific class used to indicate the force dark mode.
@ -62,59 +26,19 @@ class ForceDark {
///
///Use [ForceDark] instead.
@Deprecated("Use ForceDark instead")
class AndroidForceDark {
@ExchangeableEnum()
class AndroidForceDark_ {
// ignore: unused_field
final int _value;
const AndroidForceDark._internal(this._value);
///Set of all values of [AndroidForceDark].
static final Set<AndroidForceDark> values = [
AndroidForceDark.FORCE_DARK_OFF,
AndroidForceDark.FORCE_DARK_AUTO,
AndroidForceDark.FORCE_DARK_ON,
].toSet();
///Gets a possible [AndroidForceDark] instance from an [int] value.
static AndroidForceDark? fromValue(int? value) {
if (value != null) {
try {
return AndroidForceDark.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 "FORCE_DARK_AUTO";
case 2:
return "FORCE_DARK_ON";
case 0:
default:
return "FORCE_DARK_OFF";
}
}
const AndroidForceDark_._internal(this._value);
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
static const FORCE_DARK_OFF = const AndroidForceDark._internal(0);
static const FORCE_DARK_OFF = const AndroidForceDark_._internal(0);
///Enable force dark dependent on the state of the WebView parent view.
static const FORCE_DARK_AUTO = const AndroidForceDark._internal(1);
static const FORCE_DARK_AUTO = const AndroidForceDark_._internal(1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const FORCE_DARK_ON = const AndroidForceDark._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const FORCE_DARK_ON = const AndroidForceDark_._internal(2);
}

View File

@ -0,0 +1,169 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'force_dark.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to indicate the force dark mode.
class ForceDark {
final int _value;
final int _nativeValue;
const ForceDark._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ForceDark._internalMultiPlatform(int value, Function nativeValue) =>
ForceDark._internal(value, nativeValue());
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
static const OFF = ForceDark._internal(0, 0);
///Enable force dark dependent on the state of the WebView parent view.
static const AUTO = ForceDark._internal(1, 1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const ON = ForceDark._internal(2, 2);
///Set of all values of [ForceDark].
static final Set<ForceDark> values = [
ForceDark.OFF,
ForceDark.AUTO,
ForceDark.ON,
].toSet();
///Gets a possible [ForceDark] instance from [int] value.
static ForceDark? fromValue(int? value) {
if (value != null) {
try {
return ForceDark.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ForceDark] instance from a native value.
static ForceDark? fromNativeValue(int? value) {
if (value != null) {
try {
return ForceDark.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 'OFF';
case 1:
return 'AUTO';
case 2:
return 'ON';
}
return _value.toString();
}
}
///An Android-specific class used to indicate the force dark mode.
///
///**NOTE**: available on Android 29+.
///
///Use [ForceDark] instead.
@Deprecated('Use ForceDark instead')
class AndroidForceDark {
final int _value;
final int _nativeValue;
const AndroidForceDark._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidForceDark._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidForceDark._internal(value, nativeValue());
///Disable force dark, irrespective of the force dark mode of the WebView parent.
///In this mode, WebView content will always be rendered as-is, regardless of whether native views are being automatically darkened.
static const FORCE_DARK_OFF = AndroidForceDark._internal(0, 0);
///Enable force dark dependent on the state of the WebView parent view.
static const FORCE_DARK_AUTO = AndroidForceDark._internal(1, 1);
///Unconditionally enable force dark. In this mode WebView content will always be rendered so as to emulate a dark theme.
static const FORCE_DARK_ON = AndroidForceDark._internal(2, 2);
///Set of all values of [AndroidForceDark].
static final Set<AndroidForceDark> values = [
AndroidForceDark.FORCE_DARK_OFF,
AndroidForceDark.FORCE_DARK_AUTO,
AndroidForceDark.FORCE_DARK_ON,
].toSet();
///Gets a possible [AndroidForceDark] instance from [int] value.
static AndroidForceDark? fromValue(int? value) {
if (value != null) {
try {
return AndroidForceDark.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidForceDark] instance from a native value.
static AndroidForceDark? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidForceDark.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 'FORCE_DARK_OFF';
case 1:
return 'FORCE_DARK_AUTO';
case 2:
return 'FORCE_DARK_ON';
}
return _value.toString();
}
}

View File

@ -1,58 +1,27 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'force_dark_strategy.g.dart';
///Class used to indicate how [WebView] content should be darkened.
class ForceDarkStrategy {
@ExchangeableEnum()
class ForceDarkStrategy_ {
// ignore: unused_field
final int _value;
const ForceDarkStrategy._internal(this._value);
///Set of all values of [ForceDarkStrategy].
static final Set<ForceDarkStrategy> values = [
ForceDarkStrategy.USER_AGENT_DARKENING_ONLY,
ForceDarkStrategy.WEB_THEME_DARKENING_ONLY,
ForceDarkStrategy.PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING,
].toSet();
///Gets a possible [ForceDarkStrategy] instance from an [int] value.
static ForceDarkStrategy? fromValue(int? value) {
if (value != null) {
try {
return ForceDarkStrategy.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 "WEB_THEME_DARKENING_ONLY";
case 2:
return "PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING";
case 0:
default:
return "USER_AGENT_DARKENING_ONLY";
}
}
const ForceDarkStrategy_._internal(this._value);
///In this mode [WebView] content will be darkened by a user agent and it will ignore the web page's dark theme if it exists.
///To avoid mixing two different darkening strategies, the `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const USER_AGENT_DARKENING_ONLY = const ForceDarkStrategy._internal(0);
static const USER_AGENT_DARKENING_ONLY = const ForceDarkStrategy_._internal(0);
///In this mode [WebView] content will always be darkened using dark theme provided by web page.
///If web page does not provide dark theme support [WebView] content will be rendered with a default theme.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const WEB_THEME_DARKENING_ONLY = const ForceDarkStrategy._internal(1);
static const WEB_THEME_DARKENING_ONLY = const ForceDarkStrategy_._internal(1);
///In this mode [WebView] content will be darkened by a user agent unless web page supports dark theme.
///[WebView] determines whether web pages supports dark theme by the presence of `color-scheme` metadata containing `"dark"` value.
@ -60,10 +29,5 @@ class ForceDarkStrategy {
///If the metadata is not presented [WebView] content will be darkened by a user agent and `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING = const ForceDarkStrategy._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING = const ForceDarkStrategy_._internal(2);
}

View File

@ -0,0 +1,97 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'force_dark_strategy.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to indicate how [WebView] content should be darkened.
class ForceDarkStrategy {
final int _value;
final int _nativeValue;
const ForceDarkStrategy._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ForceDarkStrategy._internalMultiPlatform(
int value, Function nativeValue) =>
ForceDarkStrategy._internal(value, nativeValue());
///In this mode [WebView] content will be darkened by a user agent and it will ignore the web page's dark theme if it exists.
///To avoid mixing two different darkening strategies, the `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const USER_AGENT_DARKENING_ONLY = ForceDarkStrategy._internal(0, 0);
///In this mode [WebView] content will always be darkened using dark theme provided by web page.
///If web page does not provide dark theme support [WebView] content will be rendered with a default theme.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const WEB_THEME_DARKENING_ONLY = ForceDarkStrategy._internal(1, 1);
///In this mode [WebView] content will be darkened by a user agent unless web page supports dark theme.
///[WebView] determines whether web pages supports dark theme by the presence of `color-scheme` metadata containing `"dark"` value.
///For example, `<meta name="color-scheme" content="dark light">`.
///If the metadata is not presented [WebView] content will be darkened by a user agent and `prefers-color-scheme` media query will evaluate to light.
///
///See [specification](https://drafts.csswg.org/css-color-adjust-1/) for more information.
static const PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING =
ForceDarkStrategy._internal(2, 2);
///Set of all values of [ForceDarkStrategy].
static final Set<ForceDarkStrategy> values = [
ForceDarkStrategy.USER_AGENT_DARKENING_ONLY,
ForceDarkStrategy.WEB_THEME_DARKENING_ONLY,
ForceDarkStrategy.PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING,
].toSet();
///Gets a possible [ForceDarkStrategy] instance from [int] value.
static ForceDarkStrategy? fromValue(int? value) {
if (value != null) {
try {
return ForceDarkStrategy.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [ForceDarkStrategy] instance from a native value.
static ForceDarkStrategy? fromNativeValue(int? value) {
if (value != null) {
try {
return ForceDarkStrategy.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 'USER_AGENT_DARKENING_ONLY';
case 1:
return 'WEB_THEME_DARKENING_ONLY';
case 2:
return 'PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING';
}
return _value.toString();
}
}

View File

@ -1,37 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'form_resubmission_action.g.dart';
///Class that represents the action to take used by the [WebView.onFormResubmission] event.
class FormResubmissionAction {
@ExchangeableEnum()
class FormResubmissionAction_ {
// ignore: unused_field
final int _value;
const FormResubmissionAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const FormResubmissionAction_._internal(this._value);
///Resend data
static const RESEND = const FormResubmissionAction._internal(0);
static const RESEND = const FormResubmissionAction_._internal(0);
///Don't resend data
static const DONT_RESEND = const FormResubmissionAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"action": _value};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
static const DONT_RESEND = const FormResubmissionAction_._internal(1);
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'form_resubmission_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the action to take used by the [WebView.onFormResubmission] event.
class FormResubmissionAction {
final int _value;
final int _nativeValue;
const FormResubmissionAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory FormResubmissionAction._internalMultiPlatform(
int value, Function nativeValue) =>
FormResubmissionAction._internal(value, nativeValue());
///Resend data
static const RESEND = FormResubmissionAction._internal(0, 0);
///Don't resend data
static const DONT_RESEND = FormResubmissionAction._internal(1, 1);
///Set of all values of [FormResubmissionAction].
static final Set<FormResubmissionAction> values = [
FormResubmissionAction.RESEND,
FormResubmissionAction.DONT_RESEND,
].toSet();
///Gets a possible [FormResubmissionAction] instance from [int] value.
static FormResubmissionAction? fromValue(int? value) {
if (value != null) {
try {
return FormResubmissionAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [FormResubmissionAction] instance from a native value.
static FormResubmissionAction? fromNativeValue(int? value) {
if (value != null) {
try {
return FormResubmissionAction.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 'RESEND';
case 1:
return 'DONT_RESEND';
}
return _value.toString();
}
}

View File

@ -15,7 +15,7 @@ class FrameInfo {
URLRequest? request;
///The frames security origin.
dynamic securityOrigin;
SecurityOrigin? securityOrigin;
FrameInfo({required this.isMainFrame, this.request, this.securityOrigin});
///Gets a possible [FrameInfo] instance from a [Map] value.
@ -26,8 +26,9 @@ class FrameInfo {
final instance = FrameInfo(
isMainFrame: map['isMainFrame'],
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>()),
securityOrigin: SecurityOrigin.fromMap(
map['securityOrigin']?.cast<String, dynamic>()),
);
instance.securityOrigin = map['securityOrigin'];
return instance;
}
@ -36,7 +37,7 @@ class FrameInfo {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin,
"securityOrigin": securityOrigin?.toMap(),
};
}
@ -65,7 +66,7 @@ class IOSWKFrameInfo {
URLRequest? request;
///The frames security origin.
dynamic securityOrigin;
IOSWKSecurityOrigin? securityOrigin;
IOSWKFrameInfo(
{required this.isMainFrame, this.request, this.securityOrigin});
@ -77,8 +78,9 @@ class IOSWKFrameInfo {
final instance = IOSWKFrameInfo(
isMainFrame: map['isMainFrame'],
request: URLRequest.fromMap(map['request']?.cast<String, dynamic>()),
securityOrigin: IOSWKSecurityOrigin.fromMap(
map['securityOrigin']?.cast<String, dynamic>()),
);
instance.securityOrigin = map['securityOrigin'];
return instance;
}
@ -87,7 +89,7 @@ class IOSWKFrameInfo {
return {
"isMainFrame": isMainFrame,
"request": request?.toMap(),
"securityOrigin": securityOrigin,
"securityOrigin": securityOrigin?.toMap(),
};
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'geolocation_permission_show_prompt_response.g.dart';
///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.onGeolocationPermissionsShowPrompt] event.
class GeolocationPermissionShowPromptResponse {
@ExchangeableObject()
class GeolocationPermissionShowPromptResponse_ {
///The origin for which permissions are set.
String origin;
@ -12,21 +17,6 @@ class GeolocationPermissionShowPromptResponse {
///The default value is `false`.
bool retain;
GeolocationPermissionShowPromptResponse(
GeolocationPermissionShowPromptResponse_(
{required this.origin, required this.allow, this.retain = false});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"origin": origin, "allow": allow, "retain": retain};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,55 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'geolocation_permission_show_prompt_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class used by the host application to set the Geolocation permission state for an origin during the [WebView.onGeolocationPermissionsShowPrompt] event.
class GeolocationPermissionShowPromptResponse {
///The origin for which permissions are set.
String origin;
///Whether or not the origin should be allowed to use the Geolocation API.
bool allow;
///Whether the permission should be retained beyond the lifetime of a page currently being displayed by a WebView
///The default value is `false`.
bool retain;
GeolocationPermissionShowPromptResponse(
{required this.origin, required this.allow, this.retain = false});
///Gets a possible [GeolocationPermissionShowPromptResponse] instance from a [Map] value.
static GeolocationPermissionShowPromptResponse? fromMap(
Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = GeolocationPermissionShowPromptResponse(
origin: map['origin'],
allow: map['allow'],
);
instance.retain = map['retain'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"origin": origin,
"allow": allow,
"retain": retain,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'GeolocationPermissionShowPromptResponse{origin: $origin, allow: $allow, retain: $retain}';
}
}

View File

@ -1,9 +1,13 @@
import '../in_app_webview/webview.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'http_auth_response_action.dart';
part 'http_auth_response.g.dart';
///Class that represents the response used by the [WebView.onReceivedHttpAuthRequest] event.
class HttpAuthResponse {
@ExchangeableObject()
class HttpAuthResponse_ {
///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String username;
@ -14,31 +18,11 @@ class HttpAuthResponse {
bool permanentPersistence;
///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge.
HttpAuthResponseAction? action;
HttpAuthResponseAction_? action;
HttpAuthResponse(
HttpAuthResponse_(
{this.username = "",
this.password = "",
this.permanentPersistence = false,
this.action = HttpAuthResponseAction.CANCEL});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"username": username,
"password": password,
"permanentPersistence": permanentPersistence,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = HttpAuthResponseAction_.CANCEL});
}

View File

@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'http_auth_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onReceivedHttpAuthRequest] event.
class HttpAuthResponse {
///Represents the username used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String username;
///Represents the password used for the authentication if the [action] corresponds to [HttpAuthResponseAction.PROCEED]
String password;
///Indicate if the given credentials need to be saved permanently.
bool permanentPersistence;
///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge.
HttpAuthResponseAction? action;
HttpAuthResponse(
{this.username = "",
this.password = "",
this.permanentPersistence = false,
this.action = HttpAuthResponseAction.CANCEL});
///Gets a possible [HttpAuthResponse] instance from a [Map] value.
static HttpAuthResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = HttpAuthResponse();
instance.username = map['username'];
instance.password = map['password'];
instance.permanentPersistence = map['permanentPersistence'];
instance.action = HttpAuthResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"username": username,
"password": password,
"permanentPersistence": permanentPersistence,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'HttpAuthResponse{username: $username, password: $password, permanentPersistence: $permanentPersistence, action: $action}';
}
}

View File

@ -1,26 +1,22 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'http_auth_response.dart';
part 'http_auth_response_action.g.dart';
///Class used by [HttpAuthResponse] class.
class HttpAuthResponseAction {
@ExchangeableEnum()
class HttpAuthResponseAction_ {
// ignore: unused_field
final int _value;
const HttpAuthResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const HttpAuthResponseAction_._internal(this._value);
///Instructs the WebView to cancel the authentication request.
static const CANCEL = const HttpAuthResponseAction._internal(0);
static const CANCEL = const HttpAuthResponseAction_._internal(0);
///Instructs the WebView to proceed with the authentication with the given credentials.
static const PROCEED = const HttpAuthResponseAction._internal(1);
static const PROCEED = const HttpAuthResponseAction_._internal(1);
///Uses the credentials stored for the current host.
static const USE_SAVED_HTTP_AUTH_CREDENTIALS =
const HttpAuthResponseAction._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const HttpAuthResponseAction_._internal(2);
}

View File

@ -0,0 +1,86 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'http_auth_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [HttpAuthResponse] class.
class HttpAuthResponseAction {
final int _value;
final int _nativeValue;
const HttpAuthResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory HttpAuthResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
HttpAuthResponseAction._internal(value, nativeValue());
///Instructs the WebView to cancel the authentication request.
static const CANCEL = HttpAuthResponseAction._internal(0, 0);
///Instructs the WebView to proceed with the authentication with the given credentials.
static const PROCEED = HttpAuthResponseAction._internal(1, 1);
///Uses the credentials stored for the current host.
static const USE_SAVED_HTTP_AUTH_CREDENTIALS =
HttpAuthResponseAction._internal(2, 2);
///Set of all values of [HttpAuthResponseAction].
static final Set<HttpAuthResponseAction> values = [
HttpAuthResponseAction.CANCEL,
HttpAuthResponseAction.PROCEED,
HttpAuthResponseAction.USE_SAVED_HTTP_AUTH_CREDENTIALS,
].toSet();
///Gets a possible [HttpAuthResponseAction] instance from [int] value.
static HttpAuthResponseAction? fromValue(int? value) {
if (value != null) {
try {
return HttpAuthResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [HttpAuthResponseAction] instance from a native value.
static HttpAuthResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return HttpAuthResponseAction.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 'USE_SAVED_HTTP_AUTH_CREDENTIALS';
}
return _value.toString();
}
}

View File

@ -1,12 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'url_credential.dart';
import 'url_response.dart';
import 'url_authentication_challenge.dart';
import 'url_protection_space.dart';
part 'http_authentication_challenge.g.dart';
///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
///It provides all the information about the challenge.
class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
@ExchangeableObject()
class HttpAuthenticationChallenge_ extends URLAuthenticationChallenge_ {
///A count of previous failed authentication attempts.
int previousFailureCount;
@ -16,17 +21,17 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
///If the proposed credential is not nil and returns true when you call its hasPassword method, then the credential is ready to use as-is.
///If the proposed credentials hasPassword method returns false, then the credential provides a default user name,
///and the client must prompt the user for a corresponding password.
URLCredential? proposedCredential;
URLCredential_? proposedCredential;
///Use [failureResponse] instead.
@Deprecated("Use failureResponse instead")
IOSURLResponse? iosFailureResponse;
IOSURLResponse_? iosFailureResponse;
///The URL response object representing the last authentication failure.
///This value is `null` if the protocol doesnt use responses to indicate an authentication failure.
///
///**NOTE**: available only on iOS.
URLResponse? failureResponse;
URLResponse_? failureResponse;
///Use [error] instead.
@Deprecated("Use error instead")
@ -38,62 +43,13 @@ class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
///**NOTE**: available only on iOS.
String? error;
HttpAuthenticationChallenge(
HttpAuthenticationChallenge_(
{required this.previousFailureCount,
required URLProtectionSpace protectionSpace,
required URLProtectionSpace_ protectionSpace,
@Deprecated("Use failureResponse instead") this.iosFailureResponse,
this.failureResponse,
this.proposedCredential,
@Deprecated("Use error instead") this.iosError,
this.error})
: super(protectionSpace: protectionSpace) {
this.failureResponse = this.failureResponse ??
// ignore: deprecated_member_use_from_same_package
URLResponse.fromMap(this.iosFailureResponse?.toMap());
// ignore: deprecated_member_use_from_same_package
this.error = this.error ?? this.iosError;
}
///Gets a possible [HttpAuthenticationChallenge] instance from a [Map] value.
static HttpAuthenticationChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return HttpAuthenticationChallenge(
previousFailureCount: map["previousFailureCount"],
protectionSpace: URLProtectionSpace.fromMap(
map["protectionSpace"].cast<String, dynamic>())!,
proposedCredential: URLCredential.fromMap(
map["proposedCredential"]?.cast<String, dynamic>()),
// ignore: deprecated_member_use_from_same_package
iosFailureResponse: IOSURLResponse.fromMap(
map["failureResponse"]?.cast<String, dynamic>()),
failureResponse:
URLResponse.fromMap(map["failureResponse"]?.cast<String, dynamic>()),
// ignore: deprecated_member_use_from_same_package
iosError: map["error"],
error: map["error"],
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
var map = super.toMap();
map.addAll({
"previousFailureCount": previousFailureCount,
"protectionSpace": protectionSpace.toMap(),
"proposedCredential": proposedCredential?.toMap(),
"iosFailureResponse":
// ignore: deprecated_member_use_from_same_package
failureResponse?.toMap() ?? iosFailureResponse?.toMap(),
"failureResponse":
// ignore: deprecated_member_use_from_same_package
failureResponse?.toMap() ?? iosFailureResponse?.toMap(),
// ignore: deprecated_member_use_from_same_package
"iosError": error ?? iosError,
// ignore: deprecated_member_use_from_same_package
"error": error ?? iosError,
});
return map;
}
: super(protectionSpace: protectionSpace);
}

View File

@ -0,0 +1,97 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'http_authentication_challenge.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the challenge of the [WebView.onReceivedHttpAuthRequest] event.
///It provides all the information about the challenge.
class HttpAuthenticationChallenge extends URLAuthenticationChallenge {
///A count of previous failed authentication attempts.
int previousFailureCount;
///The proposed credential for this challenge.
///This method returns `null` if there is no default credential for this challenge.
///If you have previously attempted to authenticate and failed, this method returns the most recent failed credential.
///If the proposed credential is not nil and returns true when you call its hasPassword method, then the credential is ready to use as-is.
///If the proposed credentials hasPassword method returns false, then the credential provides a default user name,
///and the client must prompt the user for a corresponding password.
URLCredential? proposedCredential;
///Use [failureResponse] instead.
@Deprecated('Use failureResponse instead')
IOSURLResponse? iosFailureResponse;
///The URL response object representing the last authentication failure.
///This value is `null` if the protocol doesnt use responses to indicate an authentication failure.
///
///**NOTE**: available only on iOS.
URLResponse? failureResponse;
///Use [error] instead.
@Deprecated('Use error instead')
String? iosError;
///The error object representing the last authentication failure.
///This value is `null` if the protocol doesnt use errors to indicate an authentication failure.
///
///**NOTE**: available only on iOS.
String? error;
HttpAuthenticationChallenge(
{required this.previousFailureCount,
this.proposedCredential,
@Deprecated('Use failureResponse instead') this.iosFailureResponse,
this.failureResponse,
@Deprecated('Use error instead') this.iosError,
this.error,
required URLProtectionSpace protectionSpace})
: super(protectionSpace: protectionSpace) {
failureResponse =
failureResponse ?? URLResponse.fromMap(iosFailureResponse?.toMap());
error = error ?? iosError;
}
///Gets a possible [HttpAuthenticationChallenge] instance from a [Map] value.
static HttpAuthenticationChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = HttpAuthenticationChallenge(
protectionSpace: URLProtectionSpace.fromMap(
map['protectionSpace']?.cast<String, dynamic>())!,
previousFailureCount: map['previousFailureCount'],
proposedCredential: URLCredential.fromMap(
map['proposedCredential']?.cast<String, dynamic>()),
iosFailureResponse: IOSURLResponse.fromMap(
map['failureResponse']?.cast<String, dynamic>()),
failureResponse:
URLResponse.fromMap(map['failureResponse']?.cast<String, dynamic>()),
iosError: map['error'],
error: map['error'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace.toMap(),
"previousFailureCount": previousFailureCount,
"proposedCredential": proposedCredential?.toMap(),
"failureResponse": failureResponse?.toMap(),
"error": error,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'HttpAuthenticationChallenge{protectionSpace: $protectionSpace, previousFailureCount: $previousFailureCount, proposedCredential: $proposedCredential, failureResponse: $failureResponse, error: $error}';
}
}

View File

@ -1,38 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'in_app_webview_hit_test_result_type.dart';
part 'in_app_webview_hit_test_result.g.dart';
///Class that represents the hit result for hitting an HTML elements.
class InAppWebViewHitTestResult {
@ExchangeableObject()
class InAppWebViewHitTestResult_ {
///The type of the hit test result.
InAppWebViewHitTestResultType? type;
InAppWebViewHitTestResultType_? type;
///Additional type-dependant information about the result.
String? extra;
InAppWebViewHitTestResult({this.type, this.extra});
///Gets a possible [InAppWebViewHitTestResult] instance from a [Map] value.
static InAppWebViewHitTestResult? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return InAppWebViewHitTestResult(
type: InAppWebViewHitTestResultType.fromValue(map["type"]),
extra: map["extra"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"type": type?.toValue(), "extra": extra};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
InAppWebViewHitTestResult_({this.type, this.extra});
}

View File

@ -0,0 +1,47 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'in_app_webview_hit_test_result.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the hit result for hitting an HTML elements.
class InAppWebViewHitTestResult {
///The type of the hit test result.
InAppWebViewHitTestResultType? type;
///Additional type-dependant information about the result.
String? extra;
InAppWebViewHitTestResult({this.type, this.extra});
///Gets a possible [InAppWebViewHitTestResult] instance from a [Map] value.
static InAppWebViewHitTestResult? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = InAppWebViewHitTestResult(
type: InAppWebViewHitTestResultType.fromNativeValue(map['type']),
extra: map['extra'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type?.toNativeValue(),
"extra": extra,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'InAppWebViewHitTestResult{type: $type, extra: $extra}';
}
}

View File

@ -1,89 +1,38 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'in_app_webview_hit_test_result_type.g.dart';
///Class representing the [InAppWebViewHitTestResult] type.
class InAppWebViewHitTestResultType {
@ExchangeableEnum()
class InAppWebViewHitTestResultType_ {
// ignore: unused_field
final int _value;
const InAppWebViewHitTestResultType._internal(this._value);
///Set of all values of [InAppWebViewHitTestResultType].
static final Set<InAppWebViewHitTestResultType> values = [
InAppWebViewHitTestResultType.UNKNOWN_TYPE,
InAppWebViewHitTestResultType.PHONE_TYPE,
InAppWebViewHitTestResultType.GEO_TYPE,
InAppWebViewHitTestResultType.EMAIL_TYPE,
InAppWebViewHitTestResultType.IMAGE_TYPE,
InAppWebViewHitTestResultType.SRC_ANCHOR_TYPE,
InAppWebViewHitTestResultType.SRC_IMAGE_ANCHOR_TYPE,
InAppWebViewHitTestResultType.EDIT_TEXT_TYPE,
].toSet();
///Gets a possible [InAppWebViewHitTestResultType] instance from an [int] value.
static InAppWebViewHitTestResultType? fromValue(int? value) {
if (value != null) {
try {
return InAppWebViewHitTestResultType.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 "PHONE_TYPE";
case 3:
return "GEO_TYPE";
case 4:
return "EMAIL_TYPE";
case 5:
return "IMAGE_TYPE";
case 7:
return "SRC_ANCHOR_TYPE";
case 8:
return "SRC_IMAGE_ANCHOR_TYPE";
case 9:
return "EDIT_TEXT_TYPE";
case 0:
default:
return "UNKNOWN_TYPE";
}
}
const InAppWebViewHitTestResultType_._internal(this._value);
///Default [InAppWebViewHitTestResult], where the target is unknown.
static const UNKNOWN_TYPE = const InAppWebViewHitTestResultType._internal(0);
static const UNKNOWN_TYPE = const InAppWebViewHitTestResultType_._internal(0);
///[InAppWebViewHitTestResult] for hitting a phone number.
static const PHONE_TYPE = const InAppWebViewHitTestResultType._internal(2);
static const PHONE_TYPE = const InAppWebViewHitTestResultType_._internal(2);
///[InAppWebViewHitTestResult] for hitting a map address.
static const GEO_TYPE = const InAppWebViewHitTestResultType._internal(3);
static const GEO_TYPE = const InAppWebViewHitTestResultType_._internal(3);
///[InAppWebViewHitTestResult] for hitting an email address.
static const EMAIL_TYPE = const InAppWebViewHitTestResultType._internal(4);
static const EMAIL_TYPE = const InAppWebViewHitTestResultType_._internal(4);
///[InAppWebViewHitTestResult] for hitting an HTML::img tag.
static const IMAGE_TYPE = const InAppWebViewHitTestResultType._internal(5);
static const IMAGE_TYPE = const InAppWebViewHitTestResultType_._internal(5);
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http.
static const SRC_ANCHOR_TYPE =
const InAppWebViewHitTestResultType._internal(7);
const InAppWebViewHitTestResultType_._internal(7);
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http + HTML::img.
static const SRC_IMAGE_ANCHOR_TYPE =
const InAppWebViewHitTestResultType._internal(8);
const InAppWebViewHitTestResultType_._internal(8);
///[InAppWebViewHitTestResult] for hitting an edit text area.
static const EDIT_TEXT_TYPE =
const InAppWebViewHitTestResultType._internal(9);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const InAppWebViewHitTestResultType_._internal(9);
}

View File

@ -0,0 +1,116 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'in_app_webview_hit_test_result_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class representing the [InAppWebViewHitTestResult] type.
class InAppWebViewHitTestResultType {
final int _value;
final int _nativeValue;
const InAppWebViewHitTestResultType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory InAppWebViewHitTestResultType._internalMultiPlatform(
int value, Function nativeValue) =>
InAppWebViewHitTestResultType._internal(value, nativeValue());
///Default [InAppWebViewHitTestResult], where the target is unknown.
static const UNKNOWN_TYPE = InAppWebViewHitTestResultType._internal(0, 0);
///[InAppWebViewHitTestResult] for hitting a phone number.
static const PHONE_TYPE = InAppWebViewHitTestResultType._internal(2, 2);
///[InAppWebViewHitTestResult] for hitting a map address.
static const GEO_TYPE = InAppWebViewHitTestResultType._internal(3, 3);
///[InAppWebViewHitTestResult] for hitting an email address.
static const EMAIL_TYPE = InAppWebViewHitTestResultType._internal(4, 4);
///[InAppWebViewHitTestResult] for hitting an HTML::img tag.
static const IMAGE_TYPE = InAppWebViewHitTestResultType._internal(5, 5);
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http.
static const SRC_ANCHOR_TYPE = InAppWebViewHitTestResultType._internal(7, 7);
///[InAppWebViewHitTestResult] for hitting a HTML::a tag with src=http + HTML::img.
static const SRC_IMAGE_ANCHOR_TYPE =
InAppWebViewHitTestResultType._internal(8, 8);
///[InAppWebViewHitTestResult] for hitting an edit text area.
static const EDIT_TEXT_TYPE = InAppWebViewHitTestResultType._internal(9, 9);
///Set of all values of [InAppWebViewHitTestResultType].
static final Set<InAppWebViewHitTestResultType> values = [
InAppWebViewHitTestResultType.UNKNOWN_TYPE,
InAppWebViewHitTestResultType.PHONE_TYPE,
InAppWebViewHitTestResultType.GEO_TYPE,
InAppWebViewHitTestResultType.EMAIL_TYPE,
InAppWebViewHitTestResultType.IMAGE_TYPE,
InAppWebViewHitTestResultType.SRC_ANCHOR_TYPE,
InAppWebViewHitTestResultType.SRC_IMAGE_ANCHOR_TYPE,
InAppWebViewHitTestResultType.EDIT_TEXT_TYPE,
].toSet();
///Gets a possible [InAppWebViewHitTestResultType] instance from [int] value.
static InAppWebViewHitTestResultType? fromValue(int? value) {
if (value != null) {
try {
return InAppWebViewHitTestResultType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [InAppWebViewHitTestResultType] instance from a native value.
static InAppWebViewHitTestResultType? fromNativeValue(int? value) {
if (value != null) {
try {
return InAppWebViewHitTestResultType.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 'UNKNOWN_TYPE';
case 2:
return 'PHONE_TYPE';
case 3:
return 'GEO_TYPE';
case 4:
return 'EMAIL_TYPE';
case 5:
return 'IMAGE_TYPE';
case 7:
return 'SRC_ANCHOR_TYPE';
case 8:
return 'SRC_IMAGE_ANCHOR_TYPE';
case 9:
return 'EDIT_TEXT_TYPE';
}
return _value.toString();
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'in_app_webview_initial_data.g.dart';
///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
class InAppWebViewInitialData {
@ExchangeableObject()
class InAppWebViewInitialData_ {
///A String of data in the given encoding.
String data;
@ -11,68 +16,24 @@ class InAppWebViewInitialData {
///The encoding of the data. The default value is `"utf8"`.
String encoding;
///The URL to use as the page's base URL. The default value is `about:blank`.
late Uri baseUrl;
///The URL to use as the page's base URL. If `null` defaults to `about:blank`.
Uri? baseUrl;
///Use [historyUrl] instead.
@Deprecated('Use historyUrl instead')
late Uri androidHistoryUrl;
Uri? androidHistoryUrl;
///The URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL.
///
///This parameter is used only on Android.
late Uri historyUrl;
///The URL to use as the history entry. If `null` defaults to `about:blank`. If non-null, this must be a valid URL.
@SupportedPlatforms(platforms: [
AndroidPlatform()
])
Uri? historyUrl;
InAppWebViewInitialData(
InAppWebViewInitialData_(
{required this.data,
this.mimeType = "text/html",
this.encoding = "utf8",
Uri? baseUrl,
@Deprecated('Use historyUrl instead') Uri? androidHistoryUrl,
Uri? historyUrl}) {
this.baseUrl = baseUrl == null ? Uri.parse("about:blank") : baseUrl;
this.historyUrl = historyUrl == null
? (androidHistoryUrl == null
? Uri.parse("about:blank")
: androidHistoryUrl)
: historyUrl;
// ignore: deprecated_member_use_from_same_package
this.androidHistoryUrl = this.historyUrl;
}
///Gets a possible [InAppWebViewInitialData] instance from a [Map] value.
static InAppWebViewInitialData? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return InAppWebViewInitialData(
data: map["data"],
mimeType: map["mimeType"],
encoding: map["encoding"],
baseUrl: map["baseUrl"],
// ignore: deprecated_member_use_from_same_package
androidHistoryUrl: map["androidHistoryUrl"],
historyUrl: map["historyUrl"]);
}
///Converts instance to a map.
Map<String, String> toMap() {
return {
"data": data,
"mimeType": mimeType,
"encoding": encoding,
"baseUrl": baseUrl.toString(),
"historyUrl": historyUrl.toString()
};
}
///Converts instance to a map.
Map<String, String> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.baseUrl,
@Deprecated('Use historyUrl instead') this.androidHistoryUrl,
this.historyUrl});
}

View File

@ -0,0 +1,80 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'in_app_webview_initial_data.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Initial [data] as a content for an [WebView] instance, using [baseUrl] as the base URL for it.
class InAppWebViewInitialData {
///A String of data in the given encoding.
String data;
///The MIME type of the data, e.g. "text/html". The default value is `"text/html"`.
String mimeType;
///The encoding of the data. The default value is `"utf8"`.
String encoding;
///The URL to use as the page's base URL. If `null` defaults to `about:blank`.
Uri? baseUrl;
///Use [historyUrl] instead.
@Deprecated('Use historyUrl instead')
Uri? androidHistoryUrl;
///The URL to use as the history entry. If `null` defaults to `about:blank`. If non-null, this must be a valid URL.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
Uri? historyUrl;
InAppWebViewInitialData(
{required this.data,
this.mimeType = "text/html",
this.encoding = "utf8",
this.baseUrl,
@Deprecated('Use historyUrl instead') this.androidHistoryUrl,
this.historyUrl}) {
historyUrl = historyUrl ?? androidHistoryUrl;
}
///Gets a possible [InAppWebViewInitialData] instance from a [Map] value.
static InAppWebViewInitialData? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = InAppWebViewInitialData(
data: map['data'],
baseUrl: map['baseUrl'] != null ? Uri.parse(map['baseUrl']) : null,
androidHistoryUrl:
map['historyUrl'] != null ? Uri.parse(map['historyUrl']) : null,
historyUrl:
map['historyUrl'] != null ? Uri.parse(map['historyUrl']) : null,
);
instance.mimeType = map['mimeType'];
instance.encoding = map['encoding'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"mimeType": mimeType,
"encoding": encoding,
"baseUrl": baseUrl?.toString(),
"historyUrl": historyUrl?.toString(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'InAppWebViewInitialData{data: $data, mimeType: $mimeType, encoding: $encoding, baseUrl: $baseUrl, historyUrl: $historyUrl}';
}
}

View File

@ -1,5 +1,10 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'in_app_webview_rect.g.dart';
///A class that represents a structure that contains the location and dimensions of a rectangle.
class InAppWebViewRect {
@ExchangeableObject()
class InAppWebViewRect_ {
///x position
double x;
@ -12,40 +17,12 @@ class InAppWebViewRect {
///rect height
double height;
InAppWebViewRect(
@ExchangeableObjectConstructor()
InAppWebViewRect_(
{required this.x,
required this.y,
required this.width,
required this.height}) {
assert(this.x >= 0 && this.y >= 0 && this.width >= 0 && this.height >= 0);
}
///Gets a possible [InAppWebViewRect] instance from a [Map] value.
static InAppWebViewRect? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return InAppWebViewRect(
x: map["x"],
y: map["y"],
width: map["width"],
height: map["height"],
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"x": x, "y": y, "width": width, "height": height};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
}

View File

@ -0,0 +1,63 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'in_app_webview_rect.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///A class that represents a structure that contains the location and dimensions of a rectangle.
class InAppWebViewRect {
///x position
double x;
///y position
double y;
///rect width
double width;
///rect height
double height;
InAppWebViewRect(
{required this.x,
required this.y,
required this.width,
required this.height}) {
assert(this.x >= 0 && this.y >= 0 && this.width >= 0 && this.height >= 0);
}
///Gets a possible [InAppWebViewRect] instance from a [Map] value.
static InAppWebViewRect? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = InAppWebViewRect(
x: map['x'],
y: map['y'],
width: map['width'],
height: map['height'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"x": x,
"y": y,
"width": width,
"height": height,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'InAppWebViewRect{x: $x, y: $y, width: $width, height: $height}';
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'js_alert_request.g.dart';
///Class that represents the request of the [WebView.onJsAlert] event.
class JsAlertRequest {
@ExchangeableObject()
class JsAlertRequest_ {
///The url of the page requesting the dialog.
Uri? url;
@ -13,52 +18,12 @@ class JsAlertRequest {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**NOTE**: available only on iOS.
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? isMainFrame;
JsAlertRequest(
JsAlertRequest_(
{this.url,
this.message,
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
this.isMainFrame}) {
// ignore: deprecated_member_use_from_same_package
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
}
///Gets a possible [JsAlertRequest] instance from a [Map] value.
static JsAlertRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return JsAlertRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
message: map["message"],
// ignore: deprecated_member_use_from_same_package
iosIsMainFrame: map["isMainFrame"],
isMainFrame: map["isMainFrame"],
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
// ignore: deprecated_member_use_from_same_package
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
// ignore: deprecated_member_use_from_same_package
"isMainFrame": isMainFrame ?? iosIsMainFrame
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.isMainFrame});
}

View File

@ -0,0 +1,66 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_alert_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the request of the [WebView.onJsAlert] event.
class JsAlertRequest {
///The url of the page requesting the dialog.
Uri? url;
///Message to be displayed in the window.
String? message;
///Use [isMainFrame] instead.
@Deprecated('Use isMainFrame instead')
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? isMainFrame;
JsAlertRequest(
{this.url,
this.message,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
///Gets a possible [JsAlertRequest] instance from a [Map] value.
static JsAlertRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsAlertRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
message: map['message'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"isMainFrame": isMainFrame,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsAlertRequest{url: $url, message: $message, isMainFrame: $isMainFrame}';
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'js_alert_response_action.dart';
part 'js_alert_response.g.dart';
///Class that represents the response used by the [WebView.onJsAlert] event to control a JavaScript alert dialog.
class JsAlertResponse {
@ExchangeableObject()
class JsAlertResponse_ {
///Message to be displayed in the window.
String message;
@ -14,31 +19,11 @@ class JsAlertResponse {
bool handledByClient;
///Action used to confirm that the user hit confirm button.
JsAlertResponseAction? action;
JsAlertResponseAction_? action;
JsAlertResponse(
JsAlertResponse_(
{this.message = "",
this.handledByClient = false,
this.confirmButtonTitle = "",
this.action = JsAlertResponseAction.CONFIRM});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"handledByClient": handledByClient,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = JsAlertResponseAction_.CONFIRM});
}

View File

@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_alert_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onJsAlert] event to control a JavaScript alert dialog.
class JsAlertResponse {
///Message to be displayed in the window.
String message;
///Title of the confirm button.
String confirmButtonTitle;
///Whether the client will handle the alert dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm button.
JsAlertResponseAction? action;
JsAlertResponse(
{this.message = "",
this.confirmButtonTitle = "",
this.handledByClient = false,
this.action = JsAlertResponseAction.CONFIRM});
///Gets a possible [JsAlertResponse] instance from a [Map] value.
static JsAlertResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsAlertResponse();
instance.message = map['message'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsAlertResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsAlertResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, handledByClient: $handledByClient, action: $action}';
}
}

View File

@ -1,19 +1,16 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'js_alert_response.dart';
part 'js_alert_response_action.g.dart';
///Class used by [JsAlertResponse] class.
class JsAlertResponseAction {
@ExchangeableEnum()
class JsAlertResponseAction_ {
// ignore: unused_field
final int _value;
const JsAlertResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const JsAlertResponseAction_._internal(this._value);
///Confirm that the user hit confirm button.
static const CONFIRM = const JsAlertResponseAction._internal(0);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CONFIRM = const JsAlertResponseAction_._internal(0);
}

View File

@ -0,0 +1,73 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_alert_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [JsAlertResponse] class.
class JsAlertResponseAction {
final int _value;
final int _nativeValue;
const JsAlertResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory JsAlertResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
JsAlertResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsAlertResponseAction._internal(0, 0);
///Set of all values of [JsAlertResponseAction].
static final Set<JsAlertResponseAction> values = [
JsAlertResponseAction.CONFIRM,
].toSet();
///Gets a possible [JsAlertResponseAction] instance from [int] value.
static JsAlertResponseAction? fromValue(int? value) {
if (value != null) {
try {
return JsAlertResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [JsAlertResponseAction] instance from a native value.
static JsAlertResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return JsAlertResponseAction.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 'CONFIRM';
}
return _value.toString();
}
}

View File

@ -1,38 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'js_before_unload_request.g.dart';
///Class that represents the request of the [WebView.onJsBeforeUnload] event.
class JsBeforeUnloadRequest {
@ExchangeableObject()
class JsBeforeUnloadRequest_ {
///The url of the page requesting the dialog.
Uri? url;
///Message to be displayed in the window.
String? message;
JsBeforeUnloadRequest({this.url, this.message});
///Gets a possible [JsBeforeUnloadRequest] instance from a [Map] value.
static JsBeforeUnloadRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return JsBeforeUnloadRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
message: map["message"],
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"url": url?.toString(), "message": message};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
JsBeforeUnloadRequest_({this.url, this.message});
}

View File

@ -0,0 +1,47 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_before_unload_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the request of the [WebView.onJsBeforeUnload] event.
class JsBeforeUnloadRequest {
///The url of the page requesting the dialog.
Uri? url;
///Message to be displayed in the window.
String? message;
JsBeforeUnloadRequest({this.url, this.message});
///Gets a possible [JsBeforeUnloadRequest] instance from a [Map] value.
static JsBeforeUnloadRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsBeforeUnloadRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
message: map['message'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsBeforeUnloadRequest{url: $url, message: $message}';
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'js_before_unload_response_action.dart';
part 'js_before_unload_response.g.dart';
///Class that represents the response used by the [WebView.onJsBeforeUnload] event to control a JavaScript alert dialog.
class JsBeforeUnloadResponse {
@ExchangeableObject()
class JsBeforeUnloadResponse_ {
///Message to be displayed in the window.
String message;
@ -17,33 +22,12 @@ class JsBeforeUnloadResponse {
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsBeforeUnloadResponseAction? action;
JsBeforeUnloadResponseAction_? action;
JsBeforeUnloadResponse(
JsBeforeUnloadResponse_(
{this.message = "",
this.handledByClient = false,
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.action = JsBeforeUnloadResponseAction.CONFIRM});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = JsBeforeUnloadResponseAction_.CONFIRM});
}

View File

@ -0,0 +1,67 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_before_unload_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onJsBeforeUnload] event to control a JavaScript alert dialog.
class JsBeforeUnloadResponse {
///Message to be displayed in the window.
String message;
///Title of the confirm button.
String confirmButtonTitle;
///Title of the cancel button.
String cancelButtonTitle;
///Whether the client will handle the alert dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsBeforeUnloadResponseAction? action;
JsBeforeUnloadResponse(
{this.message = "",
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.handledByClient = false,
this.action = JsBeforeUnloadResponseAction.CONFIRM});
///Gets a possible [JsBeforeUnloadResponse] instance from a [Map] value.
static JsBeforeUnloadResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsBeforeUnloadResponse();
instance.message = map['message'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action =
JsBeforeUnloadResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsBeforeUnloadResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, action: $action}';
}
}

View File

@ -1,22 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'js_before_unload_response.dart';
part 'js_before_unload_response_action.g.dart';
///Class used by [JsBeforeUnloadResponse] class.
class JsBeforeUnloadResponseAction {
@ExchangeableEnum()
class JsBeforeUnloadResponseAction_ {
// ignore: unused_field
final int _value;
const JsBeforeUnloadResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const JsBeforeUnloadResponseAction_._internal(this._value);
///Confirm that the user hit confirm button.
static const CONFIRM = const JsBeforeUnloadResponseAction._internal(0);
static const CONFIRM = const JsBeforeUnloadResponseAction_._internal(0);
///Confirm that the user hit cancel button.
static const CANCEL = const JsBeforeUnloadResponseAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CANCEL = const JsBeforeUnloadResponseAction_._internal(1);
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_before_unload_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [JsBeforeUnloadResponse] class.
class JsBeforeUnloadResponseAction {
final int _value;
final int _nativeValue;
const JsBeforeUnloadResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory JsBeforeUnloadResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
JsBeforeUnloadResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsBeforeUnloadResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsBeforeUnloadResponseAction._internal(1, 1);
///Set of all values of [JsBeforeUnloadResponseAction].
static final Set<JsBeforeUnloadResponseAction> values = [
JsBeforeUnloadResponseAction.CONFIRM,
JsBeforeUnloadResponseAction.CANCEL,
].toSet();
///Gets a possible [JsBeforeUnloadResponseAction] instance from [int] value.
static JsBeforeUnloadResponseAction? fromValue(int? value) {
if (value != null) {
try {
return JsBeforeUnloadResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [JsBeforeUnloadResponseAction] instance from a native value.
static JsBeforeUnloadResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return JsBeforeUnloadResponseAction.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 'CONFIRM';
case 1:
return 'CANCEL';
}
return _value.toString();
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'js_confirm_request.g.dart';
///Class that represents the request of the [WebView.onJsConfirm] event.
class JsConfirmRequest {
@ExchangeableObject()
class JsConfirmRequest_ {
///The url of the page requesting the dialog.
Uri? url;
@ -13,51 +18,12 @@ class JsConfirmRequest {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**NOTE**: available only on iOS.
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? isMainFrame;
JsConfirmRequest(
JsConfirmRequest_(
{this.url,
this.message,
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
this.isMainFrame}) {
// ignore: deprecated_member_use_from_same_package
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
}
///Gets a possible [JsConfirmRequest] instance from a [Map] value.
static JsConfirmRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return JsConfirmRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
message: map["message"],
// ignore: deprecated_member_use_from_same_package
iosIsMainFrame: map["isMainFrame"],
isMainFrame: map["isMainFrame"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
// ignore: deprecated_member_use_from_same_package
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
// ignore: deprecated_member_use_from_same_package
"isMainFrame": isMainFrame ?? iosIsMainFrame
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.isMainFrame});
}

View File

@ -0,0 +1,66 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_confirm_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the request of the [WebView.onJsConfirm] event.
class JsConfirmRequest {
///The url of the page requesting the dialog.
Uri? url;
///Message to be displayed in the window.
String? message;
///Use [isMainFrame] instead.
@Deprecated('Use isMainFrame instead')
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? isMainFrame;
JsConfirmRequest(
{this.url,
this.message,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
///Gets a possible [JsConfirmRequest] instance from a [Map] value.
static JsConfirmRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsConfirmRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
message: map['message'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"isMainFrame": isMainFrame,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsConfirmRequest{url: $url, message: $message, isMainFrame: $isMainFrame}';
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'js_confirm_response_action.dart';
part 'js_confirm_response.g.dart';
///Class that represents the response used by the [WebView.onJsConfirm] event to control a JavaScript confirm dialog.
class JsConfirmResponse {
@ExchangeableObject()
class JsConfirmResponse_ {
///Message to be displayed in the window.
String message;
@ -17,31 +22,12 @@ class JsConfirmResponse {
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsConfirmResponseAction? action;
JsConfirmResponseAction_? action;
JsConfirmResponse(
JsConfirmResponse_(
{this.message = "",
this.handledByClient = false,
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.action = JsConfirmResponseAction.CANCEL});
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toValue()
};
}
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = JsConfirmResponseAction_.CANCEL});
}

View File

@ -0,0 +1,66 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_confirm_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onJsConfirm] event to control a JavaScript confirm dialog.
class JsConfirmResponse {
///Message to be displayed in the window.
String message;
///Title of the confirm button.
String confirmButtonTitle;
///Title of the cancel button.
String cancelButtonTitle;
///Whether the client will handle the confirm dialog.
bool handledByClient;
///Action used to confirm that the user hit confirm or cancel button.
JsConfirmResponseAction? action;
JsConfirmResponse(
{this.message = "",
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.handledByClient = false,
this.action = JsConfirmResponseAction.CANCEL});
///Gets a possible [JsConfirmResponse] instance from a [Map] value.
static JsConfirmResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsConfirmResponse();
instance.message = map['message'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsConfirmResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsConfirmResponse{message: $message, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, action: $action}';
}
}

View File

@ -1,22 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'js_confirm_response.dart';
part 'js_confirm_response_action.g.dart';
///Class used by [JsConfirmResponse] class.
class JsConfirmResponseAction {
@ExchangeableEnum()
class JsConfirmResponseAction_ {
// ignore: unused_field
final int _value;
const JsConfirmResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const JsConfirmResponseAction_._internal(this._value);
///Confirm that the user hit confirm button.
static const CONFIRM = const JsConfirmResponseAction._internal(0);
static const CONFIRM = const JsConfirmResponseAction_._internal(0);
///Confirm that the user hit cancel button.
static const CANCEL = const JsConfirmResponseAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CANCEL = const JsConfirmResponseAction_._internal(1);
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_confirm_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [JsConfirmResponse] class.
class JsConfirmResponseAction {
final int _value;
final int _nativeValue;
const JsConfirmResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory JsConfirmResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
JsConfirmResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsConfirmResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsConfirmResponseAction._internal(1, 1);
///Set of all values of [JsConfirmResponseAction].
static final Set<JsConfirmResponseAction> values = [
JsConfirmResponseAction.CONFIRM,
JsConfirmResponseAction.CANCEL,
].toSet();
///Gets a possible [JsConfirmResponseAction] instance from [int] value.
static JsConfirmResponseAction? fromValue(int? value) {
if (value != null) {
try {
return JsConfirmResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [JsConfirmResponseAction] instance from a native value.
static JsConfirmResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return JsConfirmResponseAction.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 'CONFIRM';
case 1:
return 'CANCEL';
}
return _value.toString();
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'js_prompt_request.g.dart';
///Class that represents the request of the [WebView.onJsPrompt] event.
class JsPromptRequest {
@ExchangeableObject()
class JsPromptRequest_ {
///The url of the page requesting the dialog.
Uri? url;
@ -16,54 +21,13 @@ class JsPromptRequest {
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**NOTE**: available only on iOS.
@SupportedPlatforms(platforms: [IOSPlatform()])
bool? isMainFrame;
JsPromptRequest(
JsPromptRequest_(
{this.url,
this.message,
this.defaultValue,
@Deprecated("Use isMainFrame instead") this.iosIsMainFrame,
this.isMainFrame}) {
// ignore: deprecated_member_use_from_same_package
this.isMainFrame = this.isMainFrame ?? this.iosIsMainFrame;
}
///Gets a possible [JsPromptRequest] instance from a [Map] value.
static JsPromptRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return JsPromptRequest(
url: map["url"] != null ? Uri.parse(map["url"]) : null,
message: map["message"],
defaultValue: map["defaultValue"],
// ignore: deprecated_member_use_from_same_package
iosIsMainFrame: map["isMainFrame"],
isMainFrame: map["isMainFrame"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"defaultValue": defaultValue,
// ignore: deprecated_member_use_from_same_package
"iosIsMainFrame": isMainFrame ?? iosIsMainFrame,
// ignore: deprecated_member_use_from_same_package
"isMainFrame": isMainFrame ?? iosIsMainFrame
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.isMainFrame});
}

View File

@ -0,0 +1,72 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_prompt_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the request of the [WebView.onJsPrompt] event.
class JsPromptRequest {
///The url of the page requesting the dialog.
Uri? url;
///Message to be displayed in the window.
String? message;
///The default value displayed in the prompt dialog.
String? defaultValue;
///Use [isMainFrame] instead.
@Deprecated('Use isMainFrame instead')
bool? iosIsMainFrame;
///Indicates whether the request was made for the main frame.
///
///**Supported Platforms/Implementations**:
///- iOS
bool? isMainFrame;
JsPromptRequest(
{this.url,
this.message,
this.defaultValue,
@Deprecated('Use isMainFrame instead') this.iosIsMainFrame,
this.isMainFrame}) {
isMainFrame = isMainFrame ?? iosIsMainFrame;
}
///Gets a possible [JsPromptRequest] instance from a [Map] value.
static JsPromptRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsPromptRequest(
url: map['url'] != null ? Uri.parse(map['url']) : null,
message: map['message'],
defaultValue: map['defaultValue'],
iosIsMainFrame: map['isMainFrame'],
isMainFrame: map['isMainFrame'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"url": url?.toString(),
"message": message,
"defaultValue": defaultValue,
"isMainFrame": isMainFrame,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsPromptRequest{url: $url, message: $message, defaultValue: $defaultValue, isMainFrame: $isMainFrame}';
}
}

View File

@ -1,9 +1,14 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
import 'js_prompt_response_action.dart';
part 'js_prompt_response.g.dart';
///Class that represents the response used by the [WebView.onJsPrompt] event to control a JavaScript prompt dialog.
class JsPromptResponse {
@ExchangeableObject()
class JsPromptResponse_ {
///Message to be displayed in the window.
String message;
@ -23,37 +28,14 @@ class JsPromptResponse {
String? value;
///Action used to confirm that the user hit confirm or cancel button.
JsPromptResponseAction? action;
JsPromptResponseAction_? action;
JsPromptResponse(
JsPromptResponse_(
{this.message = "",
this.defaultValue = "",
this.handledByClient = false,
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.value,
this.action = JsPromptResponseAction.CANCEL});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"defaultValue": defaultValue,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"value": value,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
this.action = JsPromptResponseAction_.CANCEL});
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_prompt_response.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the response used by the [WebView.onJsPrompt] event to control a JavaScript prompt dialog.
class JsPromptResponse {
///Message to be displayed in the window.
String message;
///The default value displayed in the prompt dialog.
String defaultValue;
///Title of the confirm button.
String confirmButtonTitle;
///Title of the cancel button.
String cancelButtonTitle;
///Whether the client will handle the prompt dialog.
bool handledByClient;
///Value of the prompt dialog.
String? value;
///Action used to confirm that the user hit confirm or cancel button.
JsPromptResponseAction? action;
JsPromptResponse(
{this.message = "",
this.defaultValue = "",
this.confirmButtonTitle = "",
this.cancelButtonTitle = "",
this.handledByClient = false,
this.value,
this.action = JsPromptResponseAction.CANCEL});
///Gets a possible [JsPromptResponse] instance from a [Map] value.
static JsPromptResponse? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = JsPromptResponse(
value: map['value'],
);
instance.message = map['message'];
instance.defaultValue = map['defaultValue'];
instance.confirmButtonTitle = map['confirmButtonTitle'];
instance.cancelButtonTitle = map['cancelButtonTitle'];
instance.handledByClient = map['handledByClient'];
instance.action = JsPromptResponseAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"message": message,
"defaultValue": defaultValue,
"confirmButtonTitle": confirmButtonTitle,
"cancelButtonTitle": cancelButtonTitle,
"handledByClient": handledByClient,
"value": value,
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'JsPromptResponse{message: $message, defaultValue: $defaultValue, confirmButtonTitle: $confirmButtonTitle, cancelButtonTitle: $cancelButtonTitle, handledByClient: $handledByClient, value: $value, action: $action}';
}
}

View File

@ -1,22 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'js_prompt_response.dart';
part 'js_prompt_response_action.g.dart';
///Class used by [JsPromptResponse] class.
class JsPromptResponseAction {
@ExchangeableEnum()
class JsPromptResponseAction_ {
// ignore: unused_field
final int _value;
const JsPromptResponseAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
const JsPromptResponseAction_._internal(this._value);
///Confirm that the user hit confirm button.
static const CONFIRM = const JsPromptResponseAction._internal(0);
static const CONFIRM = const JsPromptResponseAction_._internal(0);
///Confirm that the user hit cancel button.
static const CANCEL = const JsPromptResponseAction._internal(1);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const CANCEL = const JsPromptResponseAction_._internal(1);
}

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'js_prompt_response_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [JsPromptResponse] class.
class JsPromptResponseAction {
final int _value;
final int _nativeValue;
const JsPromptResponseAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory JsPromptResponseAction._internalMultiPlatform(
int value, Function nativeValue) =>
JsPromptResponseAction._internal(value, nativeValue());
///Confirm that the user hit confirm button.
static const CONFIRM = JsPromptResponseAction._internal(0, 0);
///Confirm that the user hit cancel button.
static const CANCEL = JsPromptResponseAction._internal(1, 1);
///Set of all values of [JsPromptResponseAction].
static final Set<JsPromptResponseAction> values = [
JsPromptResponseAction.CONFIRM,
JsPromptResponseAction.CANCEL,
].toSet();
///Gets a possible [JsPromptResponseAction] instance from [int] value.
static JsPromptResponseAction? fromValue(int? value) {
if (value != null) {
try {
return JsPromptResponseAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [JsPromptResponseAction] instance from a native value.
static JsPromptResponseAction? fromNativeValue(int? value) {
if (value != null) {
try {
return JsPromptResponseAction.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 'CONFIRM';
case 1:
return 'CANCEL';
}
return _value.toString();
}
}

View File

@ -1,105 +1,52 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_settings.dart';
import '../in_app_webview/android/in_app_webview_options.dart';
part 'layout_algorithm.g.dart';
///Class used to set the underlying layout algorithm.
class LayoutAlgorithm {
@ExchangeableEnum()
class LayoutAlgorithm_ {
// ignore: unused_field
final String _value;
const LayoutAlgorithm._internal(this._value);
///Set of all values of [LayoutAlgorithm].
static final Set<LayoutAlgorithm> values = [
LayoutAlgorithm.NORMAL,
LayoutAlgorithm.TEXT_AUTOSIZING,
LayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [LayoutAlgorithm] instance from a [String] value.
static LayoutAlgorithm? fromValue(String? value) {
if (value != null) {
try {
return LayoutAlgorithm.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const LayoutAlgorithm_._internal(this._value);
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = const LayoutAlgorithm._internal("NORMAL");
static const NORMAL = const LayoutAlgorithm_._internal("NORMAL");
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
///It is recommended to enable zoom support [InAppWebViewSettings.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
const LayoutAlgorithm._internal("TEXT_AUTOSIZING");
const LayoutAlgorithm_._internal("TEXT_AUTOSIZING");
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
static const NARROW_COLUMNS =
const LayoutAlgorithm._internal("NARROW_COLUMNS");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const LayoutAlgorithm_._internal("NARROW_COLUMNS");
}
///An Android-specific class used to set the underlying layout algorithm.
///Use [LayoutAlgorithm] instead.
@Deprecated("Use LayoutAlgorithm instead")
class AndroidLayoutAlgorithm {
@ExchangeableEnum()
class AndroidLayoutAlgorithm_ {
// ignore: unused_field
final String _value;
const AndroidLayoutAlgorithm._internal(this._value);
///Set of all values of [AndroidLayoutAlgorithm].
static final Set<AndroidLayoutAlgorithm> values = [
AndroidLayoutAlgorithm.NORMAL,
AndroidLayoutAlgorithm.TEXT_AUTOSIZING,
AndroidLayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [AndroidLayoutAlgorithm] instance from a [String] value.
static AndroidLayoutAlgorithm? fromValue(String? value) {
if (value != null) {
try {
return AndroidLayoutAlgorithm.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
const AndroidLayoutAlgorithm_._internal(this._value);
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = const AndroidLayoutAlgorithm._internal("NORMAL");
static const NORMAL = const AndroidLayoutAlgorithm_._internal("NORMAL");
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
const AndroidLayoutAlgorithm._internal("TEXT_AUTOSIZING");
const AndroidLayoutAlgorithm_._internal("TEXT_AUTOSIZING");
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
static const NARROW_COLUMNS =
const AndroidLayoutAlgorithm._internal("NARROW_COLUMNS");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
const AndroidLayoutAlgorithm_._internal("NARROW_COLUMNS");
}

View File

@ -0,0 +1,159 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'layout_algorithm.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to set the underlying layout algorithm.
class LayoutAlgorithm {
final String _value;
final String _nativeValue;
const LayoutAlgorithm._internal(this._value, this._nativeValue);
// ignore: unused_element
factory LayoutAlgorithm._internalMultiPlatform(
String value, Function nativeValue) =>
LayoutAlgorithm._internal(value, nativeValue());
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = LayoutAlgorithm._internal('NORMAL', 'NORMAL');
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [InAppWebViewSettings.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
LayoutAlgorithm._internal('TEXT_AUTOSIZING', 'TEXT_AUTOSIZING');
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
static const NARROW_COLUMNS =
LayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///Set of all values of [LayoutAlgorithm].
static final Set<LayoutAlgorithm> values = [
LayoutAlgorithm.NORMAL,
LayoutAlgorithm.TEXT_AUTOSIZING,
LayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [LayoutAlgorithm] instance from [String] value.
static LayoutAlgorithm? fromValue(String? value) {
if (value != null) {
try {
return LayoutAlgorithm.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [LayoutAlgorithm] instance from a native value.
static LayoutAlgorithm? fromNativeValue(String? value) {
if (value != null) {
try {
return LayoutAlgorithm.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;
}
}
///An Android-specific class used to set the underlying layout algorithm.
///Use [LayoutAlgorithm] instead.
@Deprecated('Use LayoutAlgorithm instead')
class AndroidLayoutAlgorithm {
final String _value;
final String _nativeValue;
const AndroidLayoutAlgorithm._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidLayoutAlgorithm._internalMultiPlatform(
String value, Function nativeValue) =>
AndroidLayoutAlgorithm._internal(value, nativeValue());
///NORMAL means no rendering changes. This is the recommended choice for maximum compatibility across different platforms and Android versions.
static const NORMAL = AndroidLayoutAlgorithm._internal('NORMAL', 'NORMAL');
///TEXT_AUTOSIZING boosts font size of paragraphs based on heuristics to make the text readable when viewing a wide-viewport layout in the overview mode.
///It is recommended to enable zoom support [AndroidInAppWebViewOptions.supportZoom] when using this mode.
///
///**NOTE**: available on Android 19+.
static const TEXT_AUTOSIZING =
AndroidLayoutAlgorithm._internal('TEXT_AUTOSIZING', 'TEXT_AUTOSIZING');
///NARROW_COLUMNS makes all columns no wider than the screen if possible. Only use this for API levels prior to `Build.VERSION_CODES.KITKAT`.
static const NARROW_COLUMNS =
AndroidLayoutAlgorithm._internal('NARROW_COLUMNS', 'NARROW_COLUMNS');
///Set of all values of [AndroidLayoutAlgorithm].
static final Set<AndroidLayoutAlgorithm> values = [
AndroidLayoutAlgorithm.NORMAL,
AndroidLayoutAlgorithm.TEXT_AUTOSIZING,
AndroidLayoutAlgorithm.NARROW_COLUMNS,
].toSet();
///Gets a possible [AndroidLayoutAlgorithm] instance from [String] value.
static AndroidLayoutAlgorithm? fromValue(String? value) {
if (value != null) {
try {
return AndroidLayoutAlgorithm.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidLayoutAlgorithm] instance from a native value.
static AndroidLayoutAlgorithm? fromNativeValue(String? value) {
if (value != null) {
try {
return AndroidLayoutAlgorithm.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,74 +1,33 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'layout_in_display_cutout_mode.g.dart';
///Class representing the share state that should be applied to the custom tab.
///
///**NOTE**: available on Android 28+.
class LayoutInDisplayCutoutMode {
@ExchangeableEnum()
class LayoutInDisplayCutoutMode_ {
// ignore: unused_field
final int _value;
const LayoutInDisplayCutoutMode._internal(this._value);
///Set of all values of [LayoutInDisplayCutoutMode].
static final Set<LayoutInDisplayCutoutMode> values = [
LayoutInDisplayCutoutMode.DEFAULT,
LayoutInDisplayCutoutMode.SHORT_EDGES,
LayoutInDisplayCutoutMode.NEVER,
LayoutInDisplayCutoutMode.ALWAYS
].toSet();
///Gets a possible [LayoutInDisplayCutoutMode] instance from an [int] value.
static LayoutInDisplayCutoutMode? fromValue(int? value) {
if (value != null) {
try {
return LayoutInDisplayCutoutMode.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 "SHORT_EDGES";
case 2:
return "NEVER";
case 3:
return "ALWAYS";
case 0:
default:
return "DEFAULT";
}
}
const LayoutInDisplayCutoutMode_._internal(this._value);
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = const LayoutInDisplayCutoutMode._internal(0);
static const DEFAULT = const LayoutInDisplayCutoutMode_._internal(0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = const LayoutInDisplayCutoutMode._internal(1);
static const SHORT_EDGES = const LayoutInDisplayCutoutMode_._internal(1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = const LayoutInDisplayCutoutMode._internal(2);
static const NEVER = const LayoutInDisplayCutoutMode_._internal(2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = const LayoutInDisplayCutoutMode._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const ALWAYS = const LayoutInDisplayCutoutMode_._internal(3);
}
///Android-specific class representing the share state that should be applied to the custom tab.
@ -77,73 +36,30 @@ class LayoutInDisplayCutoutMode {
///
///Use [LayoutInDisplayCutoutMode] instead.
@Deprecated("Use LayoutInDisplayCutoutMode instead")
class AndroidLayoutInDisplayCutoutMode {
@ExchangeableEnum()
class AndroidLayoutInDisplayCutoutMode_ {
// ignore: unused_field
final int _value;
const AndroidLayoutInDisplayCutoutMode._internal(this._value);
///Set of all values of [AndroidLayoutInDisplayCutoutMode].
static final Set<AndroidLayoutInDisplayCutoutMode> values = [
AndroidLayoutInDisplayCutoutMode.DEFAULT,
AndroidLayoutInDisplayCutoutMode.SHORT_EDGES,
AndroidLayoutInDisplayCutoutMode.NEVER,
AndroidLayoutInDisplayCutoutMode.ALWAYS
].toSet();
///Gets a possible [AndroidLayoutInDisplayCutoutMode] instance from an [int] value.
static AndroidLayoutInDisplayCutoutMode? fromValue(int? value) {
if (value != null) {
try {
return AndroidLayoutInDisplayCutoutMode.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 "SHORT_EDGES";
case 2:
return "NEVER";
case 3:
return "ALWAYS";
case 0:
default:
return "DEFAULT";
}
}
const AndroidLayoutInDisplayCutoutMode_._internal(this._value);
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = const AndroidLayoutInDisplayCutoutMode._internal(0);
static const DEFAULT = const AndroidLayoutInDisplayCutoutMode_._internal(0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES =
const AndroidLayoutInDisplayCutoutMode._internal(1);
const AndroidLayoutInDisplayCutoutMode_._internal(1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = const AndroidLayoutInDisplayCutoutMode._internal(2);
static const NEVER = const AndroidLayoutInDisplayCutoutMode_._internal(2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = const AndroidLayoutInDisplayCutoutMode._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const ALWAYS = const AndroidLayoutInDisplayCutoutMode_._internal(3);
}

View File

@ -0,0 +1,197 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'layout_in_display_cutout_mode.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class representing the share state that should be applied to the custom tab.
class LayoutInDisplayCutoutMode {
final int _value;
final int _nativeValue;
const LayoutInDisplayCutoutMode._internal(this._value, this._nativeValue);
// ignore: unused_element
factory LayoutInDisplayCutoutMode._internalMultiPlatform(
int value, Function nativeValue) =>
LayoutInDisplayCutoutMode._internal(value, nativeValue());
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = LayoutInDisplayCutoutMode._internal(0, 0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = LayoutInDisplayCutoutMode._internal(1, 1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = LayoutInDisplayCutoutMode._internal(2, 2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = LayoutInDisplayCutoutMode._internal(3, 3);
///Set of all values of [LayoutInDisplayCutoutMode].
static final Set<LayoutInDisplayCutoutMode> values = [
LayoutInDisplayCutoutMode.DEFAULT,
LayoutInDisplayCutoutMode.SHORT_EDGES,
LayoutInDisplayCutoutMode.NEVER,
LayoutInDisplayCutoutMode.ALWAYS,
].toSet();
///Gets a possible [LayoutInDisplayCutoutMode] instance from [int] value.
static LayoutInDisplayCutoutMode? fromValue(int? value) {
if (value != null) {
try {
return LayoutInDisplayCutoutMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [LayoutInDisplayCutoutMode] instance from a native value.
static LayoutInDisplayCutoutMode? fromNativeValue(int? value) {
if (value != null) {
try {
return LayoutInDisplayCutoutMode.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 1:
return 'SHORT_EDGES';
case 2:
return 'NEVER';
case 3:
return 'ALWAYS';
}
return _value.toString();
}
}
///Android-specific class representing the share state that should be applied to the custom tab.
///
///**NOTE**: available on Android 28+.
///
///Use [LayoutInDisplayCutoutMode] instead.
@Deprecated('Use LayoutInDisplayCutoutMode instead')
class AndroidLayoutInDisplayCutoutMode {
final int _value;
final int _nativeValue;
const AndroidLayoutInDisplayCutoutMode._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory AndroidLayoutInDisplayCutoutMode._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidLayoutInDisplayCutoutMode._internal(value, nativeValue());
///With this default setting, content renders into the cutout area when displayed in portrait mode, but content is letterboxed when displayed in landscape mode.
///
///**NOTE**: available on Android 28+.
static const DEFAULT = AndroidLayoutInDisplayCutoutMode._internal(0, 0);
///Content renders into the cutout area in both portrait and landscape modes.
///
///**NOTE**: available on Android 28+.
static const SHORT_EDGES = AndroidLayoutInDisplayCutoutMode._internal(1, 1);
///Content never renders into the cutout area.
///
///**NOTE**: available on Android 28+.
static const NEVER = AndroidLayoutInDisplayCutoutMode._internal(2, 2);
///The window is always allowed to extend into the DisplayCutout areas on the all edges of the screen.
///
///**NOTE**: available on Android 30+.
static const ALWAYS = AndroidLayoutInDisplayCutoutMode._internal(3, 3);
///Set of all values of [AndroidLayoutInDisplayCutoutMode].
static final Set<AndroidLayoutInDisplayCutoutMode> values = [
AndroidLayoutInDisplayCutoutMode.DEFAULT,
AndroidLayoutInDisplayCutoutMode.SHORT_EDGES,
AndroidLayoutInDisplayCutoutMode.NEVER,
AndroidLayoutInDisplayCutoutMode.ALWAYS,
].toSet();
///Gets a possible [AndroidLayoutInDisplayCutoutMode] instance from [int] value.
static AndroidLayoutInDisplayCutoutMode? fromValue(int? value) {
if (value != null) {
try {
return AndroidLayoutInDisplayCutoutMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidLayoutInDisplayCutoutMode] instance from a native value.
static AndroidLayoutInDisplayCutoutMode? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidLayoutInDisplayCutoutMode.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 1:
return 'SHORT_EDGES';
case 2:
return 'NEVER';
case 3:
return 'ALWAYS';
}
return _value.toString();
}
}

View File

@ -1,8 +1,13 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'loaded_resource.g.dart';
///Class representing a resource response of the [WebView].
///It is used by the method [WebView.onLoadResource].
class LoadedResource {
@ExchangeableObject()
class LoadedResource_ {
///A string representing the type of resource.
String? initiatorType;
@ -15,37 +20,5 @@ class LoadedResource {
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
double? duration;
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
///Gets a possible [LoadedResource] instance from a [Map] value.
static LoadedResource? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return LoadedResource(
initiatorType: map["initiatorType"],
url: map["url"] != null ? Uri.parse(map["url"]) : null,
startTime: map["startTime"],
duration: map["duration"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"initiatorType": initiatorType,
"url": url?.toString(),
"startTime": startTime,
"duration": duration
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
LoadedResource_({this.initiatorType, this.url, this.startTime, this.duration});
}

View File

@ -0,0 +1,58 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'loaded_resource.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class representing a resource response of the [WebView].
///It is used by the method [WebView.onLoadResource].
class LoadedResource {
///A string representing the type of resource.
String? initiatorType;
///Resource URL.
Uri? url;
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) for the time a resource fetch started.
double? startTime;
///Returns the [DOMHighResTimeStamp](https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp) duration to fetch a resource.
double? duration;
LoadedResource({this.initiatorType, this.url, this.startTime, this.duration});
///Gets a possible [LoadedResource] instance from a [Map] value.
static LoadedResource? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = LoadedResource(
initiatorType: map['initiatorType'],
url: map['url'] != null ? Uri.parse(map['url']) : null,
startTime: map['startTime'],
duration: map['duration'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"initiatorType": initiatorType,
"url": url?.toString(),
"startTime": startTime,
"duration": duration,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'LoadedResource{initiatorType: $initiatorType, url: $url, startTime: $startTime, duration: $duration}';
}
}

View File

@ -1,7 +1,12 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart';
part 'login_request.g.dart';
///Class used by [WebView.onReceivedLoginRequest] event.
class LoginRequest {
@ExchangeableObject()
class LoginRequest_ {
///The account realm used to look up accounts.
String realm;
@ -12,32 +17,5 @@ class LoginRequest {
///Authenticator specific arguments used to log in the user.
String args;
LoginRequest({required this.realm, this.account, required this.args});
///Gets a possible [LoginRequest] instance from a [Map] value.
static LoginRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return LoginRequest(
realm: map["realm"],
account: map["account"],
args: map["args"],
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"realm": realm, "account": account, "args": args};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
LoginRequest_({required this.realm, this.account, required this.args});
}

View File

@ -0,0 +1,53 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'login_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class used by [WebView.onReceivedLoginRequest] event.
class LoginRequest {
///The account realm used to look up accounts.
String realm;
///An optional account. If not `null`, the account should be checked against accounts on the device.
///If it is a valid account, it should be used to log in the user. This value may be `null`.
String? account;
///Authenticator specific arguments used to log in the user.
String args;
LoginRequest({required this.realm, this.account, required this.args});
///Gets a possible [LoginRequest] instance from a [Map] value.
static LoginRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = LoginRequest(
realm: map['realm'],
account: map['account'],
args: map['args'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"realm": realm,
"account": account,
"args": args,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'LoginRequest{realm: $realm, account: $account, args: $args}';
}
}

View File

@ -1,56 +1,20 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'media_capture_state.g.dart';
///Class that describes whether a media device, like a camera or microphone, is currently capturing audio or video.
class MediaCaptureState {
@ExchangeableEnum()
class MediaCaptureState_ {
// ignore: unused_field
final int _value;
const MediaCaptureState._internal(this._value);
///Set of all values of [MediaCaptureState].
static final Set<MediaCaptureState> values = [
MediaCaptureState.NONE,
MediaCaptureState.ACTIVE,
MediaCaptureState.MUTED,
].toSet();
///Gets a possible [MediaCaptureState] instance from an [int] value.
static MediaCaptureState? fromValue(int? value) {
if (value != null) {
try {
return MediaCaptureState.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 "ACTIVE";
case 2:
return "MUTED";
case 0:
default:
return "NONE";
}
}
const MediaCaptureState_._internal(this._value);
///The media device is off.
static const NONE = const MediaCaptureState._internal(0);
static const NONE = const MediaCaptureState_._internal(0);
///The media device is actively capturing audio or video.
static const ACTIVE = const MediaCaptureState._internal(1);
static const ACTIVE = const MediaCaptureState_._internal(1);
///The media device is muted, and not actively capturing audio or video.
static const MUTED = const MediaCaptureState._internal(2);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const MUTED = const MediaCaptureState_._internal(2);
}

View File

@ -0,0 +1,85 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'media_capture_state.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that describes whether a media device, like a camera or microphone, is currently capturing audio or video.
class MediaCaptureState {
final int _value;
final int _nativeValue;
const MediaCaptureState._internal(this._value, this._nativeValue);
// ignore: unused_element
factory MediaCaptureState._internalMultiPlatform(
int value, Function nativeValue) =>
MediaCaptureState._internal(value, nativeValue());
///The media device is off.
static const NONE = MediaCaptureState._internal(0, 0);
///The media device is actively capturing audio or video.
static const ACTIVE = MediaCaptureState._internal(1, 1);
///The media device is muted, and not actively capturing audio or video.
static const MUTED = MediaCaptureState._internal(2, 2);
///Set of all values of [MediaCaptureState].
static final Set<MediaCaptureState> values = [
MediaCaptureState.NONE,
MediaCaptureState.ACTIVE,
MediaCaptureState.MUTED,
].toSet();
///Gets a possible [MediaCaptureState] instance from [int] value.
static MediaCaptureState? fromValue(int? value) {
if (value != null) {
try {
return MediaCaptureState.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [MediaCaptureState] instance from a native value.
static MediaCaptureState? fromNativeValue(int? value) {
if (value != null) {
try {
return MediaCaptureState.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 'NONE';
case 1:
return 'ACTIVE';
case 2:
return 'MUTED';
}
return _value.toString();
}
}

View File

@ -1,62 +1,23 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'media_playback_state.g.dart';
///Class that describes whether an audio or video presentation is playing, paused, or suspended.
class MediaPlaybackState {
@ExchangeableEnum()
class MediaPlaybackState_ {
// ignore: unused_field
final int _value;
const MediaPlaybackState._internal(this._value);
///Set of all values of [MediaPlaybackState].
static final Set<MediaPlaybackState> values = [
MediaPlaybackState.NONE,
MediaPlaybackState.PLAYING,
MediaPlaybackState.PAUSED,
MediaPlaybackState.SUSPENDED,
].toSet();
///Gets a possible [MediaPlaybackState] instance from an [int] value.
static MediaPlaybackState? fromValue(int? value) {
if (value != null) {
try {
return MediaPlaybackState.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 "PLAYING";
case 2:
return "PAUSED";
case 3:
return "SUSPENDED";
case 0:
default:
return "NONE";
}
}
const MediaPlaybackState_._internal(this._value);
///There is no media to play back.
static const NONE = const MediaPlaybackState._internal(0);
static const NONE = const MediaPlaybackState_._internal(0);
///The media is playing.
static const PLAYING = const MediaPlaybackState._internal(1);
static const PLAYING = const MediaPlaybackState_._internal(1);
///The media playback is paused.
static const PAUSED = const MediaPlaybackState._internal(2);
static const PAUSED = const MediaPlaybackState_._internal(2);
///The media is not playing, and cannot be resumed until the user revokes the suspension.
static const SUSPENDED = const MediaPlaybackState._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
static const SUSPENDED = const MediaPlaybackState_._internal(3);
}

Some files were not shown because too many files have changed in this diff Show More