added initial code generator and example

This commit is contained in:
Lorenzo Pichilli 2022-05-17 22:54:43 +02:00
parent c81cfc964c
commit 8968353551
66 changed files with 5816 additions and 1252 deletions

View File

@ -1,4 +1,11 @@
include: package:flutter_lints/flutter.yaml include: package:lints/recommended.yaml
linter:
rules:
constant_identifier_names: ignore
# Additional information about this file can be found at # Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options # https://dart.dev/guides/language/analysis-options
analyzer:
errors:
deprecated_member_use_from_same_package: ignore

View File

@ -0,0 +1,8 @@
library flutter_inappwebview_internal_annotations;
export 'src/exchangeable_object.dart';
export 'src/exchangeable_object_constructor.dart';
export 'src/exchangeable_object_property.dart';
export 'src/exchangeable_enum.dart';
export 'src/supported_platforms.dart';
export 'src/enum_supported_platforms.dart';

View File

@ -0,0 +1,115 @@
import 'supported_platforms.dart';
abstract class EnumPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "";
final targetPlatformName = "";
}
class EnumAndroidPlatform implements EnumPlatform, AndroidPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumAndroidPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "Android native WebView";
final targetPlatformName = "android";
}
class EnumIOSPlatform implements EnumPlatform, IOSPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumIOSPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "iOS";
final targetPlatformName = "iOS";
}
class EnumMacOSPlatform implements EnumPlatform, MacOSPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumMacOSPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "MacOS";
final targetPlatformName = "macOS";
}
class EnumWindowsPlatform implements EnumPlatform, WindowsPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumWindowsPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "Windows";
final targetPlatformName = "windows";
}
class EnumLinuxPlatform implements EnumPlatform, LinuxPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
const EnumLinuxPlatform(
{this.available, this.apiName, this.apiUrl, this.note, this.value});
final name = "Linux";
final targetPlatformName = "linux";
}
class EnumWebPlatform implements EnumPlatform, WebPlatform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final dynamic value;
final bool requiresSameOrigin;
const EnumWebPlatform(
{this.available,
this.apiName,
this.apiUrl,
this.note,
this.value,
this.requiresSameOrigin = true});
final name = "Web";
final targetPlatformName = "web";
}
class EnumSupportedPlatforms {
final List<EnumPlatform> platforms;
final dynamic defaultValue;
const EnumSupportedPlatforms({
required this.platforms,
this.defaultValue,
});
}

View File

@ -0,0 +1,23 @@
class ExchangeableEnum {
final bool valuesProperty;
final bool toValueMethod;
final bool fromValueMethod;
final bool toNativeValueMethod;
final bool fromNativeValueMethod;
final bool toStringMethod;
final bool hashCodeMethod;
final bool equalsOperator;
final bool bitwiseOrOperator;
const ExchangeableEnum({
this.valuesProperty = true,
this.toValueMethod = true,
this.fromValueMethod = true,
this.toNativeValueMethod = true,
this.fromNativeValueMethod = true,
this.toStringMethod = true,
this.hashCodeMethod = true,
this.equalsOperator = true,
this.bitwiseOrOperator = false
});
}

View File

@ -0,0 +1,15 @@
class ExchangeableObject {
final bool toMapMethod;
final bool toJsonMethod;
final bool fromMapFactory;
final bool nullableFromMapFactory;
final bool toStringMethod;
const ExchangeableObject({
this.toMapMethod = true,
this.toJsonMethod = true,
this.fromMapFactory = true,
this.nullableFromMapFactory = true,
this.toStringMethod = true,
});
}

View File

@ -0,0 +1,3 @@
class ExchangeableObjectConstructor {
const ExchangeableObjectConstructor();
}

View File

@ -0,0 +1,9 @@
class ExchangeableObjectProperty {
final Function? serializer;
final Function? deserializer;
const ExchangeableObjectProperty({
this.serializer,
this.deserializer
});
}

View File

@ -0,0 +1,95 @@
abstract class Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const Platform({this.available, this.apiName, this.apiUrl, this.note});
final name = "";
final targetPlatformName = "";
}
class AndroidPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const AndroidPlatform({this.available, this.apiName, this.apiUrl, this.note});
final name = "Android native WebView";
final targetPlatformName = "android";
}
class IOSPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const IOSPlatform({this.available, this.apiName, this.apiUrl, this.note});
final name = "iOS";
final targetPlatformName = "iOS";
}
class MacOSPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const MacOSPlatform({this.available, this.apiName, this.apiUrl, this.note});
final name = "MacOS";
final targetPlatformName = "macOS";
}
class WindowsPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const WindowsPlatform({this.available, this.apiName, this.apiUrl, this.note});
final name = "Windows";
final targetPlatformName = "windows";
}
class LinuxPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
const LinuxPlatform({this.available, this.apiName, this.apiUrl, this.note});
final name = "Linux";
final targetPlatformName = "linux";
}
class WebPlatform implements Platform {
final String? available;
final String? apiName;
final String? apiUrl;
final String? note;
final bool requiresSameOrigin;
const WebPlatform(
{this.available,
this.apiName,
this.apiUrl,
this.note,
this.requiresSameOrigin = true});
final name = "Web";
final targetPlatformName = "web";
}
class SupportedPlatforms {
final List<Platform> platforms;
const SupportedPlatforms({required this.platforms});
}

View File

@ -0,0 +1,383 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.33.6+1"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "5.2.1"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.6+9"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_rpc_2:
dependency: transitive
description:
name: json_rpc_2
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.2"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.6+9"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
multi_server_socket:
dependency: transitive
description:
name: multi_server_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.13"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.10"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.1"
plugin:
dependency: transitive
description:
name: plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+3"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.9"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.9+2"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4+1"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vm_service_client:
dependency: transitive
description:
name: vm_service_client
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.6+3"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+15"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
sdks:
dart: ">=2.16.0-100.0.dev <3.0.0"

View File

@ -0,0 +1,10 @@
name: flutter_inappwebview_internal_annotations
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
version: 1.0.0
homepage: https://github.com/pichillilorenzo/flutter_inappwebview
environment:
sdk: ">=2.14.0 <3.0.0"
dev_dependencies:
test: 1.3.4

View File

@ -0,0 +1,21 @@
targets:
$default:
builders:
generators|flutter_inappwebview_internal_annotations:
enabled: true
builders:
generators:
target: ":generators"
# 1
import: "package:generators/builder.dart"
# 2
builder_factories: ["generateExchangeableObject", "generateExchangeableEnum"]
# 3
build_extensions: { ".dart": [".g.dart"] }
auto_apply: dependents
build_to: cache
applies_builders: ["source_gen|combining_builder"]
defaults:
generate_for:
- lib/src/**.dart

View File

@ -0,0 +1,10 @@
import 'package:build/build.dart';
import 'package:source_gen/source_gen.dart';
import 'src/exchangeable_object_generator.dart';
import 'src/exchangeable_enum_generator.dart';
Builder generateExchangeableObject(BuilderOptions options) =>
SharedPartBuilder([ExchangeableObjectGenerator()], 'exchangeable_object');
Builder generateExchangeableEnum(BuilderOptions options) =>
SharedPartBuilder([ExchangeableEnumGenerator()], 'exchangeable_enum');

View File

@ -0,0 +1 @@
library generators;

View File

@ -0,0 +1,270 @@
import 'package:build/src/builder/build_step.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:source_gen/source_gen.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'package:analyzer/dart/constant/value.dart';
import 'model_visitor.dart';
import 'util.dart';
final _coreCheckerEnumSupportedPlatforms =
const TypeChecker.fromRuntime(EnumSupportedPlatforms);
final _coreCheckerDeprecated = const TypeChecker.fromRuntime(Deprecated);
class ExchangeableEnumGenerator
extends GeneratorForAnnotation<ExchangeableEnum> {
@override
String generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) {
final visitor = ModelVisitor();
// Visits all the children of element in no particular order.
element.visitChildren(visitor);
final className = visitor.constructor.returnType.element.name;
// remove "_" to generate the correct class name
final extClassName = className.replaceFirst("_", "");
final classBuffer = StringBuffer();
final classDocs =
visitor.constructor.returnType.element.documentationComment;
if (classDocs != null) {
classBuffer.writeln(classDocs);
}
final classSupportedDocs = Util.getSupportedDocs(
_coreCheckerEnumSupportedPlatforms,
visitor.constructor.returnType.element);
if (classSupportedDocs != null) {
classBuffer.writeln(classSupportedDocs);
}
if (visitor.constructor.returnType.element.hasDeprecated) {
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element)?.getField("message")?.toStringValue()}')");
}
classBuffer.writeln('class $extClassName {');
final FieldElement enumValue = visitor.fields.entries
.firstWhere((element) => element.key == "_value")
.value;
final FieldElement enumNativeValue = visitor.fields.entries
.firstWhere((element) => element.key == "_nativeValue",
orElse: () => MapEntry("_nativeValue", enumValue))
.value;
classBuffer.writeln("final ${enumValue.type} _value;");
classBuffer.writeln("final ${enumNativeValue.type} _nativeValue;");
classBuffer.writeln(
"const $extClassName._internal(this._value, this._nativeValue);");
classBuffer.writeln("// ignore: unused_element");
classBuffer.writeln(
"factory $extClassName._internalMultiPlatform(${enumValue.type} value, Function nativeValue) => $extClassName._internal(value, nativeValue());");
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (fieldName == "_value" || fieldName == "_nativeValue") {
continue;
}
final docs = fieldElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
}
final fieldSupportedDocs = Util.getSupportedDocs(
_coreCheckerEnumSupportedPlatforms, fieldElement);
if (fieldSupportedDocs != null) {
classBuffer.writeln(fieldSupportedDocs);
}
if (fieldName == '_value' || fieldName == '_nativeValue') {
classBuffer.writeln(
"final ${fieldElement.type.toString().replaceFirst("_", "")} $fieldName;");
} else {
final fieldValue =
fieldElement.computeConstantValue()?.getField("_value");
final constantValue = fieldValue != null && !fieldValue.isNull
? fieldValue.toIntValue() ?? "\'${fieldValue.toStringValue()}\'"
: null;
final fieldAnnotation = _coreCheckerEnumSupportedPlatforms
.firstAnnotationOfExact(fieldElement);
if (fieldAnnotation != null) {
final defaultField = fieldAnnotation.getField('defaultValue')!;
final defaultValue = !defaultField.isNull
? defaultField.toIntValue() ?? "'${defaultField.toStringValue()}'"
: null;
var nativeValueBody = "() {";
nativeValueBody += "switch (defaultTargetPlatform) {";
final platforms =
fieldAnnotation.getField('platforms')?.toListValue() ??
<DartObject>[];
var hasWebSupport = false;
var webSupportValue = null;
if (platforms.isNotEmpty) {
for (var platform in platforms) {
final targetPlatformName =
platform.getField("targetPlatformName")!.toStringValue();
final platformValueField = platform.getField('value');
final platformValue =
platformValueField != null && !platformValueField.isNull
? platformValueField.toIntValue() ??
"'${platformValueField.toStringValue()}'"
: null;
if (targetPlatformName == "web") {
hasWebSupport = true;
webSupportValue = platformValue;
continue;
}
nativeValueBody += "case TargetPlatform.$targetPlatformName:";
nativeValueBody += "return $platformValue;";
}
nativeValueBody += "default:";
nativeValueBody += "break;";
}
nativeValueBody += "}";
if (hasWebSupport) {
nativeValueBody += "if (kIsWeb) {";
nativeValueBody += "return $webSupportValue;";
nativeValueBody += "}";
}
nativeValueBody += "return $defaultValue;";
nativeValueBody += "}";
classBuffer.writeln(
"static final $fieldName = $extClassName._internalMultiPlatform($constantValue, $nativeValueBody);");
} else {
classBuffer.writeln(
"static const $fieldName = $extClassName._internal($constantValue, $constantValue);");
}
}
}
if (annotation.read("valuesProperty").boolValue) {
classBuffer.writeln('///Set of all values of [$extClassName].');
classBuffer.writeln('static final Set<$extClassName> values = [');
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && fieldElement.isStatic) {
classBuffer.writeln('$extClassName.$fieldName,');
}
}
classBuffer.writeln('].toSet();');
}
if (annotation.read("fromValueMethod").boolValue && !visitor.methods.containsKey("fromValue")) {
final hasBitwiseOrOperator =
annotation.read("bitwiseOrOperator").boolValue;
classBuffer.writeln("""
///Gets a possible [$extClassName] instance from [${enumValue.type}] value.
static $extClassName? fromValue(${enumValue.type}${!Util.typeIsNullable(enumValue.type) ? '?' : ''} value) {
if (value != null) {
try {
return $extClassName.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return ${!hasBitwiseOrOperator ? 'null' : "$extClassName._internal(value, value)"};
}
}
return null;
}
""");
}
if (annotation.read("fromNativeValueMethod").boolValue && !visitor.methods.containsKey("fromNativeValue")) {
final hasBitwiseOrOperator =
annotation.read("bitwiseOrOperator").boolValue;
classBuffer.writeln("""
///Gets a possible [$extClassName] instance from a native value.
static $extClassName? fromNativeValue(${enumNativeValue.type}${!Util.typeIsNullable(enumNativeValue.type) ? '?' : ''} value) {
if (value != null) {
try {
return $extClassName.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return ${!hasBitwiseOrOperator ? 'null' : "$extClassName._internal(value, value)"};
}
}
return null;
}
""");
}
for (final entry in visitor.methods.entries) {
final methodElement = entry.value;
ParsedLibraryResult parsed = methodElement.session?.getParsedLibraryByElement(methodElement.library) as ParsedLibraryResult;
final methodBody = parsed.getElementDeclaration(methodElement)?.node;
if (methodBody != null) {
final docs = methodElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
}
final fieldSupportedDocs =
Util.getSupportedDocs(_coreCheckerEnumSupportedPlatforms, methodElement);
if (fieldSupportedDocs != null) {
classBuffer.writeln(fieldSupportedDocs);
}
classBuffer.writeln(methodBody);
}
}
if (annotation.read("toValueMethod").boolValue && !visitor.methods.containsKey("toValue")) {
classBuffer.writeln("""
///Gets [${enumValue.type}] value.
${enumValue.type} toValue() => _value;
""");
}
if (annotation.read("toNativeValueMethod").boolValue && !visitor.methods.containsKey("toNativeValue")) {
classBuffer.writeln("""
///Gets [${enumNativeValue.type}] native value.
${enumNativeValue.type} toNativeValue() => _nativeValue;
""");
}
if (annotation.read("hashCodeMethod").boolValue && !visitor.fields.containsKey("hashCode")) {
classBuffer.writeln("""
@override
int get hashCode => _value.hashCode;
""");
}
if (annotation.read("equalsOperator").boolValue) {
classBuffer.writeln("""
@override
bool operator ==(value) => value == _value;
""");
}
if (annotation.read("bitwiseOrOperator").boolValue) {
classBuffer.writeln(
"$extClassName operator |($extClassName value) => $extClassName._internal(value.toValue() | _value, value.toNativeValue() | _nativeValue);");
}
if (annotation.read("toStringMethod").boolValue && !visitor.methods.containsKey("toString")) {
classBuffer.writeln('@override');
classBuffer.writeln('String toString() {');
if (enumValue.type.isDartCoreString) {
classBuffer.writeln('return _value;');
} else {
classBuffer.writeln('switch(_value) {');
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && fieldElement.isStatic) {
final fieldValue =
fieldElement.computeConstantValue()?.getField("_value");
final constantValue = fieldValue?.toIntValue();
classBuffer.writeln("case $constantValue: return '$fieldName';");
}
}
classBuffer.writeln('}');
classBuffer.writeln('return _value.toString();');
}
classBuffer.writeln('}');
}
classBuffer.writeln('}');
return classBuffer.toString();
}
}

View File

@ -0,0 +1,676 @@
import 'package:build/src/builder/build_step.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/analysis/results.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:source_gen/source_gen.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'model_visitor.dart';
import 'util.dart';
final _coreChecker = const TypeChecker.fromRuntime(ExchangeableObject);
final _coreCheckerObjectConstructor =
const TypeChecker.fromRuntime(ExchangeableObjectConstructor);
final _coreCheckerObjectProperty =
const TypeChecker.fromRuntime(ExchangeableObjectProperty);
final _coreCheckerEnum = const TypeChecker.fromRuntime(ExchangeableEnum);
final _coreCheckerDeprecated = const TypeChecker.fromRuntime(Deprecated);
final _coreCheckerSupportedPlatforms =
const TypeChecker.fromRuntime(SupportedPlatforms);
class ExchangeableObjectGenerator
extends GeneratorForAnnotation<ExchangeableObject> {
@override
String generateForAnnotatedElement(
Element element, ConstantReader annotation, BuildStep buildStep) {
final visitor = ModelVisitor();
// Visits all the children of element in no particular order.
element.visitChildren(visitor);
final className = visitor.constructor.returnType.element.name;
final superClass =
visitor.constructor.returnType.superclass?.element.name != 'Object'
? visitor.constructor.returnType.superclass
: null;
final superClassName = superClass?.element.name.replaceFirst("_", "");
// remove "_" to generate the correct class name
final extClassName = className.replaceFirst("_", "");
final classBuffer = StringBuffer();
final classDocs =
visitor.constructor.returnType.element.documentationComment;
if (classDocs != null) {
classBuffer.writeln(classDocs);
}
final classSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms, visitor.constructor.returnType.element);
if (classSupportedDocs != null) {
classBuffer.writeln(classSupportedDocs);
}
if (visitor.constructor.returnType.element.hasDeprecated) {
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(visitor.constructor.returnType.element)?.getField("message")?.toStringValue()}')");
}
classBuffer.write('class $extClassName');
if (superClass != null) {
classBuffer.writeln(' extends ${superClassName}');
}
classBuffer.writeln(' {');
final deprecatedFields = <VariableElement>[];
final constructorFields = <String>[];
final superConstructorFields = <String>[];
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate) {
final isNullable = Util.typeIsNullable(fieldElement.type);
final constructorParameter = visitor.constructorParameters[fieldName];
if (constructorParameter != null) {
// remove class reference terminating with "_"
var defaultValueCode =
constructorParameter.defaultValueCode?.replaceFirst("_.", ".");
var constructorField =
'${!isNullable && defaultValueCode == null ? 'required ' : ''}this.$fieldName${defaultValueCode != null ? ' = $defaultValueCode' : ''}';
if (fieldElement.hasDeprecated) {
deprecatedFields.add(fieldElement);
constructorField =
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(fieldElement)?.getField("message")?.toStringValue()}') " +
constructorField;
}
constructorFields.add(constructorField);
}
}
final docs = fieldElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
}
final fieldSupportedDocs =
Util.getSupportedDocs(_coreCheckerSupportedPlatforms, fieldElement);
if (fieldSupportedDocs != null) {
classBuffer.writeln(fieldSupportedDocs);
}
if (fieldElement.hasDeprecated) {
classBuffer.writeln(
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(fieldElement)?.getField("message")?.toStringValue()}')");
}
// remove class reference terminating with "_"
classBuffer
.write("${fieldElement.type.toString().replaceFirst("_", "")} ");
if (!fieldElement.hasInitializer) {
classBuffer.writeln("$fieldName;");
} else {
ParsedLibraryResult parsed = fieldElement.session
?.getParsedLibraryByElement(fieldElement.library)
as ParsedLibraryResult;
final fieldBody = parsed.getElementDeclaration(fieldElement)?.node;
classBuffer.writeln("$fieldBody;");
}
}
if (superClass != null) {
ConstructorElement superConstructor = superClass.constructors.first;
for (final parameter in superConstructor.parameters) {
final parameterName = parameter.name;
final parameterType = parameter.type;
final isNullable = Util.typeIsNullable(parameter.type);
// remove class reference terminating with "_"
var defaultValueCode =
parameter.defaultValueCode?.replaceFirst("_.", ".");
var constructorField =
'${!isNullable && defaultValueCode == null ? 'required ' : ''}$parameterType $parameterName${defaultValueCode != null ? ' = $defaultValueCode' : ''}';
if (parameter.hasDeprecated) {
deprecatedFields.add(parameter);
constructorField =
"@Deprecated('${_coreCheckerDeprecated.firstAnnotationOfExact(parameter)?.getField("message")?.toStringValue()}') " +
constructorField;
}
constructorFields.add(constructorField);
superConstructorFields.add("$parameterName: $parameterName");
}
}
final hasCustomConstructor =
_coreCheckerObjectConstructor.hasAnnotationOf(visitor.constructor);
final constructorDocs = visitor.constructor.documentationComment;
if (constructorDocs != null) {
classBuffer.writeln(constructorDocs);
}
var constructorSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms, visitor.constructor);
if (constructorSupportedDocs == null) {
constructorSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms,
visitor.constructor.returnType.element);
}
if (constructorSupportedDocs != null) {
classBuffer.writeln(constructorSupportedDocs);
}
if (hasCustomConstructor) {
ParsedLibraryResult parsed = visitor.constructor.session
?.getParsedLibraryByElement(visitor.constructor.library)
as ParsedLibraryResult;
final constructorBody =
parsed.getElementDeclaration(visitor.constructor)?.node;
if (constructorBody != null) {
classBuffer.writeln(constructorBody
.toString()
.replaceAll(className, extClassName)
.replaceAll("@ExchangeableObjectConstructor()", ""));
}
} else if (constructorFields.length > 0) {
classBuffer.writeln('$extClassName({');
classBuffer.writeln(constructorFields.join(', '));
} else {
classBuffer.writeln('$extClassName(');
}
if (!hasCustomConstructor && constructorFields.length > 0) {
classBuffer.write('})');
} else if (!hasCustomConstructor) {
classBuffer.write(')');
}
if (superClass != null) {
classBuffer.write(': super(');
if (superConstructorFields.isNotEmpty) {
classBuffer.write('${superConstructorFields.join(", ")}');
}
classBuffer.write(')');
}
if (!hasCustomConstructor && deprecatedFields.length > 0) {
classBuffer.writeln(' {');
for (final deprecatedField in deprecatedFields) {
final deprecatedFieldName = deprecatedField.name;
final message = _coreCheckerDeprecated
.firstAnnotationOfExact(deprecatedField)!
.getField("message")!
.toStringValue()!;
final fieldName = message
.replaceFirst("Use ", "")
.replaceFirst(" instead", "")
.trim();
final fieldElement = visitor.fields[fieldName]!;
final fieldTypeElement = fieldElement.type.element;
final deprecatedFieldTypeElement = deprecatedField.type.element;
classBuffer.write('$fieldName = $fieldName ?? ');
if (fieldTypeElement != null && deprecatedFieldTypeElement != null) {
final isNullable = Util.typeIsNullable(fieldElement.type);
final deprecatedIsNullable = Util.typeIsNullable(deprecatedField.type);
final hasFromMap = hasFromMapMethod(fieldTypeElement);
final hasFromNativeValue = hasFromNativeValueMethod(fieldTypeElement);
final hasFromValue = hasFromValueMethod(fieldTypeElement);
final deprecatedHasToMap = hasFromMapMethod(deprecatedFieldTypeElement);
final deprecatedHasToNativeValue = hasToNativeValueMethod(deprecatedFieldTypeElement);
final deprecatedHasToValue = hasToValueMethod(deprecatedFieldTypeElement);
if (hasFromMap && deprecatedHasToMap) {
final hasNullableFromMap = hasNullableFromMapFactory(fieldTypeElement);
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
".fromMap($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toMap())${!isNullable && hasNullableFromMap ? '!' : ''}");
} else if (hasFromNativeValue && deprecatedHasToNativeValue) {
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
'.fromNativeValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toNativeValue())${!isNullable ? '!' : ''}');
} else if (hasFromValue && deprecatedHasToValue) {
classBuffer.write(fieldTypeElement.name!.replaceFirst("_", "") +
'.fromValue($deprecatedFieldName${deprecatedIsNullable ? '?' : ''}.toValue())${!isNullable ? '!' : ''}');
} else {
classBuffer.write(deprecatedFieldName);
}
} else {
classBuffer.write(deprecatedFieldName);
}
classBuffer.writeln(';');
}
classBuffer.writeln('}');
} else if (!hasCustomConstructor) {
classBuffer.writeln(';');
}
if (annotation.read("fromMapFactory").boolValue &&
!visitor.methods.containsKey("fromMap")) {
classBuffer.writeln(
'///Gets a possible [$extClassName] instance from a [Map] value.');
final nullable = annotation.read("nullableFromMapFactory").boolValue;
classBuffer
.writeln('static $extClassName${nullable ? '?' : ''} fromMap(');
classBuffer.writeln('Map<String, dynamic>${nullable ? '?' : ''} map');
classBuffer.writeln(') {');
if (nullable) {
classBuffer.writeln('if (map == null) { return null; }');
}
classBuffer.writeln('final instance = $extClassName(');
final fieldElements = <FieldElement>[];
if (superClass != null) {
fieldElements.addAll(superClass.element.fields);
}
fieldElements.addAll(visitor.fields.values);
final nonRequiredFields = <String>[];
final requiredFields = <String>[];
for (final fieldElement in fieldElements) {
final fieldName = fieldElement.name;
if (!fieldElement.isPrivate) {
var value = "map['$fieldName']";
final deprecationMessage = _coreCheckerDeprecated
.firstAnnotationOfExact(fieldElement)
?.getField("message")
?.toStringValue();
if (deprecationMessage != null) {
final newFieldName = deprecationMessage
.replaceFirst("Use ", "")
.replaceFirst(" instead", "")
.trim();
value = "map['$newFieldName']";
}
final customDeserializer = _coreCheckerObjectProperty
.firstAnnotationOf(fieldElement)
?.getField("deserializer")
?.toFunctionValue();
if (customDeserializer != null) {
final deserializerClassName = customDeserializer.enclosingElement.name;
if (deserializerClassName != null) {
value = "$deserializerClassName.${customDeserializer.name}($value)";
} else {
value = "${customDeserializer.name}($value)";
}
} else {
value = getFromMapValue(value, fieldElement.type);
}
final constructorParameter =
visitor.constructorParameters[fieldName];
final isRequiredParameter = constructorParameter != null &&
(constructorParameter.isRequiredNamed ||
!Util.typeIsNullable(constructorParameter.type)) &&
!constructorParameter.hasDefaultValue;
if (isRequiredParameter) {
requiredFields.add('$fieldName: $value,');
} else {
nonRequiredFields.add("instance.$fieldName = $value;");
}
}
}
classBuffer.writeln(requiredFields.join("\n") + ');');
if (nonRequiredFields.isNotEmpty) {
classBuffer.writeln(nonRequiredFields.join("\n"));
}
classBuffer.writeln('return instance;');
classBuffer.writeln('}');
}
for (final entry in visitor.methods.entries) {
final methodElement = entry.value;
ParsedLibraryResult parsed = methodElement.session
?.getParsedLibraryByElement(methodElement.library)
as ParsedLibraryResult;
final methodBody = parsed.getElementDeclaration(methodElement)?.node;
if (methodBody != null) {
final docs = methodElement.documentationComment;
if (docs != null) {
classBuffer.writeln(docs);
}
final fieldSupportedDocs = Util.getSupportedDocs(
_coreCheckerSupportedPlatforms, methodElement);
if (fieldSupportedDocs != null) {
classBuffer.writeln(fieldSupportedDocs);
}
classBuffer
.writeln(methodBody.toString().replaceAll(className, extClassName));
}
}
if (annotation.read("toMapMethod").boolValue &&
!visitor.methods.containsKey("toMap")) {
classBuffer.writeln('///Converts instance to a map.');
classBuffer.writeln('Map<String, dynamic> toMap() {');
classBuffer.writeln('return {');
final fieldElements = <FieldElement>[];
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
fieldElements.add(fieldElement);
}
}
}
for (final entry in visitor.fields.entries) {
final fieldElement = entry.value;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
fieldElements.add(fieldElement);
}
}
for (final fieldElement in fieldElements) {
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
final fieldName = fieldElement.name;
var mapValue = fieldName;
final customSerializer = _coreCheckerObjectProperty
.firstAnnotationOf(fieldElement)
?.getField("serializer")
?.toFunctionValue();
if (customSerializer != null) {
final serializerClassName = customSerializer.enclosingElement.name;
if (serializerClassName != null) {
mapValue = "$serializerClassName.${customSerializer.name}($mapValue)";
} else {
mapValue = "${customSerializer.name}($mapValue)";
}
} else {
mapValue = getToMapValue(fieldName, fieldElement.type);
}
classBuffer.writeln('"$fieldName": $mapValue,');
}
}
classBuffer.writeln('};');
classBuffer.writeln('}');
}
if (annotation.read("toJsonMethod").boolValue &&
!visitor.methods.containsKey("toJson")) {
classBuffer.writeln('///Converts instance to a map.');
classBuffer.writeln('Map<String, dynamic> toJson() {');
classBuffer.writeln('return toMap();');
classBuffer.writeln('}');
}
if (annotation.read("toStringMethod").boolValue &&
!visitor.methods.containsKey("toString")) {
classBuffer.writeln('@override');
classBuffer.writeln('String toString() {');
classBuffer.write('return \'$extClassName{');
final fieldNames = <String>[];
if (superClass != null) {
for (final fieldElement in superClass.element.fields) {
final fieldName = fieldElement.name;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
fieldNames.add('$fieldName: \$$fieldName');
}
}
}
for (final entry in visitor.fields.entries) {
final fieldName = entry.key;
final fieldElement = entry.value;
if (!fieldElement.isPrivate && !fieldElement.hasDeprecated) {
fieldNames.add('$fieldName: \$$fieldName');
}
}
classBuffer.write(fieldNames.join(', '));
classBuffer.writeln('}\';');
classBuffer.writeln('}');
}
classBuffer.writeln('}');
return classBuffer.toString();
}
String getFromMapValue(String value, DartType elementType) {
final fieldTypeElement = elementType.element;
final isNullable = Util.typeIsNullable(elementType);
if (elementType.getDisplayString(withNullability: false) == "Uri") {
if (!isNullable) {
return "Uri.parse($value)!";
} else {
return "$value != null ? Uri.parse($value) : null";
}
} else if (elementType.getDisplayString(withNullability: false) ==
"Color") {
if (!isNullable) {
return "UtilColor.fromStringRepresentation($value)!";
} else {
return "$value != null ? UtilColor.fromStringRepresentation($value) : null";
}
} else if (elementType.getDisplayString(withNullability: false) ==
"DateTime") {
if (!isNullable) {
return "DateTime.fromMillisecondsSinceEpoch($value)!";
} else {
return "$value != null ? DateTime.fromMillisecondsSinceEpoch($value) : null";
}
} else if (elementType.isDartCoreList || elementType.isDartCoreSet) {
final genericType = Util.getGenericTypes(elementType).first;
if (!Util.isDartCoreType(genericType)) {
final genericTypeFieldName = 'e';
return value +
(isNullable ? '?' : '') +
'.forEach(($genericTypeFieldName) => ' +
getFromMapValue('$genericTypeFieldName', genericType) +
')';
} else {
return value;
}
} else if (fieldTypeElement != null && hasFromMapMethod(fieldTypeElement)) {
final hasNullableFromMap = hasNullableFromMapFactory(fieldTypeElement);
// remove class reference terminating with "_"
return fieldTypeElement.name!.replaceFirst("_", "") +
".fromMap($value?.cast<String, dynamic>())${!isNullable && hasNullableFromMap ? '!' : ''}";
} else {
final hasFromValue =
fieldTypeElement != null && hasFromValueMethod(fieldTypeElement);
final hasFromNativeValue = fieldTypeElement != null &&
hasFromNativeValueMethod(fieldTypeElement);
if (fieldTypeElement != null && (hasFromValue || hasFromNativeValue)) {
if (hasFromNativeValue) {
// remove class reference terminating with "_"
value = fieldTypeElement.name!.replaceFirst("_", "") +
'.fromNativeValue($value)';
} else {
// remove class reference terminating with "_"
value = fieldTypeElement.name!.replaceFirst("_", "") +
'.fromValue($value)';
}
if (!isNullable) {
value += '!';
}
return value;
}
}
return value;
}
String getToMapValue(String fieldName, DartType elementType) {
final fieldTypeElement = elementType.element;
final isNullable = Util.typeIsNullable(elementType);
if (elementType.getDisplayString(withNullability: false) == "Uri") {
return fieldName + (isNullable ? '?' : '') + '.toString()';
} else if (elementType.getDisplayString(withNullability: false) ==
"Color") {
return fieldName + (isNullable ? '?' : '') + '.toHex()';
} else if (elementType.getDisplayString(withNullability: false) ==
"DateTime") {
return fieldName + (isNullable ? '?' : '') + '.millisecondsSinceEpoch';
} else if (elementType.isDartCoreList || elementType.isDartCoreSet) {
final genericType = Util.getGenericTypes(elementType).first;
if (!Util.isDartCoreType(genericType)) {
final genericTypeFieldName = 'e';
return fieldName +
(isNullable ? '?' : '') +
'.map(($genericTypeFieldName) => ' +
getToMapValue('$genericTypeFieldName', genericType) +
').toList()';
} else {
return fieldName;
}
} else if (fieldTypeElement != null && hasToMapMethod(fieldTypeElement)) {
return fieldName +
(Util.typeIsNullable(elementType) ? '?' : '') +
'.toMap()';
} else {
final hasToValue =
fieldTypeElement != null && hasToValueMethod(fieldTypeElement);
final hasToNativeValue =
fieldTypeElement != null && hasToNativeValueMethod(fieldTypeElement);
if (fieldTypeElement != null && (hasToValue || hasToNativeValue)) {
if (hasToNativeValue) {
return fieldName + (isNullable ? '?' : '') + '.toNativeValue()';
} else {
return fieldName + (isNullable ? '?' : '') + '.toValue()';
}
}
}
return fieldName;
}
bool hasToMapMethod(Element element) {
final hasAnnotation = _coreChecker.hasAnnotationOf(element);
final toMapMethod = _coreChecker
.firstAnnotationOfExact(element)
?.getField('toMapMethod')
?.toBoolValue() ??
false;
if (hasAnnotation && toMapMethod) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "toMap") {
return true;
}
}
return false;
}
bool hasFromMapMethod(Element element) {
final hasAnnotation = _coreChecker.hasAnnotationOf(element);
final fromMapFactory = _coreChecker
.firstAnnotationOfExact(element)
?.getField('fromMapFactory')
?.toBoolValue() ??
false;
if (hasAnnotation && fromMapFactory) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "fromMap") {
return true;
}
}
return false;
}
bool hasNullableFromMapFactory(Element element) {
final hasAnnotation = _coreChecker.hasAnnotationOf(element);
final fromMapFactory = _coreChecker
.firstAnnotationOfExact(element)
?.getField('fromMapFactory')
?.toBoolValue() ??
false;
final nullableFromMapFactory = _coreChecker
.firstAnnotationOfExact(element)
?.getField('nullableFromMapFactory')
?.toBoolValue() ??
false;
if (hasAnnotation && fromMapFactory && nullableFromMapFactory) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "fromMap" &&
Util.typeIsNullable(entry.value.returnType)) {
return true;
}
}
return false;
}
bool hasFromValueMethod(Element element) {
final hasAnnotation = _coreCheckerEnum.hasAnnotationOf(element);
final fromValueMethod = _coreCheckerEnum
.firstAnnotationOfExact(element)
?.getField('fromValueMethod')
?.toBoolValue() ??
false;
if (hasAnnotation && fromValueMethod) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "fromValue") {
return true;
}
}
return false;
}
bool hasFromNativeValueMethod(Element element) {
final hasAnnotation = _coreCheckerEnum.hasAnnotationOf(element);
final fromNativeValueMethod = _coreCheckerEnum
.firstAnnotationOfExact(element)
?.getField('fromNativeValueMethod')
?.toBoolValue() ??
false;
if (hasAnnotation && fromNativeValueMethod) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "fromNativeValue") {
return true;
}
}
return false;
}
bool hasToValueMethod(Element element) {
final hasAnnotation = _coreCheckerEnum.hasAnnotationOf(element);
final hasToValueMethod = _coreCheckerEnum
.firstAnnotationOfExact(element)
?.getField('toValueMethod')
?.toBoolValue() ??
false;
if (hasAnnotation && hasToValueMethod) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "toValue") {
return true;
}
}
return false;
}
bool hasToNativeValueMethod(Element element) {
final hasAnnotation = _coreCheckerEnum.hasAnnotationOf(element);
final hasToNativeValueMethod = _coreCheckerEnum
.firstAnnotationOfExact(element)
?.getField('toNativeValueMethod')
?.toBoolValue() ??
false;
if (hasAnnotation && hasToNativeValueMethod) {
return true;
}
final fieldVisitor = ModelVisitor();
element.visitChildren(fieldVisitor);
for (var entry in fieldVisitor.methods.entries) {
if (entry.key == "toNativeValue") {
return true;
}
}
return false;
}
}

View File

@ -0,0 +1,27 @@
import 'package:analyzer/dart/element/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
class ModelVisitor extends SimpleElementVisitor<void> {
late ConstructorElement constructor;
final constructorParameters = <String, ParameterElement>{};
final fields = <String, FieldElement>{};
final methods = <String, MethodElement>{};
@override
void visitConstructorElement(ConstructorElement element) {
constructor = element;
for (final param in element.parameters) {
constructorParameters.putIfAbsent(param.name, () => param);
}
}
@override
void visitFieldElement(FieldElement element) {
fields[element.name] = element;
}
@override
void visitMethodElement(MethodElement element) {
methods[element.name] = element;
}
}

View File

@ -0,0 +1,91 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:source_gen/source_gen.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/constant/value.dart';
abstract class Util {
static bool typeIsNullable(DartType type) {
return type.nullabilitySuffix != NullabilitySuffix.none ||
type.toString() == 'dynamic';
}
static String? getSupportedDocs(TypeChecker checker, Element element) {
final platformNoteList = <String>[];
final platformSupportedList = <String>[];
final platforms = checker
.firstAnnotationOfExact(element)
?.getField('platforms')
?.toListValue() ??
<DartObject>[];
for (var platform in platforms) {
final platformName = platform.getField("name")!.toStringValue();
final note = platform.getField("note")?.toStringValue();
if (note != null) {
platformNoteList.add("///**NOTE for $platformName**: $note");
}
final apiName = platform.getField("apiName")?.toStringValue();
final apiUrl = platform.getField("apiUrl")?.toStringValue();
final available = platform.getField("available")?.toStringValue();
final requiresSameOrigin =
platform.getField("requiresSameOrigin")?.toBoolValue() ?? false;
var api = available != null ? "$available+ " : "";
if (requiresSameOrigin) {
api += "but iframe requires same origin ";
}
if (apiName != null && apiUrl != null) {
api += "([Official API - $apiName]($apiUrl))";
} else if (apiName != null) {
api += "(Official API - $apiName)";
} else if (apiUrl != null) {
api += "([Official API]($apiUrl))";
}
platformSupportedList.add("///- $platformName $api");
}
if (platformSupportedList.isNotEmpty) {
if (platformNoteList.isNotEmpty) {
return """///
${platformNoteList.join("\n///\n")}
///
///**Supported Platforms/Implementations**:
${platformSupportedList.join("\n")}""";
} else {
return """///
///**Supported Platforms/Implementations**:
${platformSupportedList.join("\n")}""";
}
}
return null;
}
static Iterable<DartType> getGenericTypes(DartType type) {
return type is ParameterizedType ? type.typeArguments : const [];
}
static bool canHaveGenerics(DartType type) {
final element = type.element;
if (element is ClassElement) {
return element.typeParameters.isNotEmpty;
}
return false;
}
static bool isDartCoreType(DartType type) {
return type.isDartCoreBool ||
type.isDartCoreDouble ||
type.isDartCoreEnum ||
type.isDartCoreFunction ||
type.isDartCoreInt ||
type.isDartCoreIterable ||
type.isDartCoreList ||
type.isDartCoreMap ||
type.isDartCoreNull ||
type.isDartCoreNum ||
type.isDartCoreObject ||
type.isDartCoreSet ||
type.isDartCoreString ||
type.isDartCoreSymbol ||
type.isDynamic;
}
}

View File

@ -0,0 +1,513 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "39.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
build:
dependency: "direct main"
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
build_test:
dependency: "direct dev"
description:
name: build_test
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
coverage:
dependency: transitive
description:
name: coverage
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_inappwebview_internal_annotations:
dependency: "direct main"
description:
path: "../flutter_inappwebview_internal_annotations"
relative: true
source: path
version: "1.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
node_preamble:
dependency: transitive
description:
name: node_preamble
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
shelf_packages_handler:
dependency: transitive
description:
name: shelf_packages_handler
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0"
shelf_static:
dependency: transitive
description:
name: shelf_static
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: "direct main"
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
source_map_stack_trace:
dependency: transitive
description:
name: source_map_stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
source_maps:
dependency: transitive
description:
name: source_maps
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.10"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test:
dependency: "direct dev"
description:
name: test
url: "https://pub.dartlang.org"
source: hosted
version: "1.21.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
test_core:
dependency: transitive
description:
name: test_core
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.13"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
vm_service:
dependency: transitive
description:
name: vm_service
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
webkit_inspection_protocol:
dependency: transitive
description:
name: webkit_inspection_protocol
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.16.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -0,0 +1,21 @@
name: generators
version: 1.0.0
publish_to: none
environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"
dependencies:
flutter:
sdk: flutter
build:
source_gen:
flutter_inappwebview_internal_annotations:
path: ../flutter_inappwebview_internal_annotations/
dev_dependencies:
build_runner:
build_test:
test: ^1.21.1

View File

@ -0,0 +1,11 @@
include: package:lints/recommended.yaml
linter:
rules:
constant_identifier_names: ignore
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
analyzer:
errors:
deprecated_member_use_from_same_package: ignore

View File

@ -0,0 +1,6 @@
import 'package:test_gen/src/types/main.dart';
import 'package:test_gen/src/types/test_enum.dart';
void main() {
TestClass test = TestClass(test1: "test1", test2: TestClass2(test1: ""), actionModeMenuItem: ActionModeMenuItem.MENU_ITEM_NONE);
}

View File

@ -0,0 +1,10 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'test_class_2.g.dart';
@ExchangeableObject()
class TestClass2_ {
String test1;
TestClass2_({required this.test1});
}

View File

@ -0,0 +1,2 @@
export 'test_class.dart' show TestClass;
export '../test/test_class_2.dart' show TestClass2;

View File

@ -0,0 +1,68 @@
import 'package:flutter/material.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../test/test_class_2.dart';
import 'test_enum.dart';
part 'test_class.g.dart';
///Custom docs
@ExchangeableObject()
@SupportedPlatforms(platforms: [
AndroidPlatform(
apiName: "TestClass",
available: "24",
note: "[test1] is always `null`."
),
IOSPlatform(
apiName: "TestClass",
available: "15.0",
note: "[test2] is always `null`."
),
WebPlatform(),
])
class TestClass_ extends TestClass3 {
///Docs 1
String test1;
///Docs 2
List<TestClass2_> test2;
List<Color?>? colors;
///Docs 3
@SupportedPlatforms(platforms: [
AndroidPlatform(
apiName: "WebSettings.setDisabledActionModeMenuItems",
apiUrl: "https://developer.android.com/reference/android/webkit/WebSettings#setDisabledActionModeMenuItems(int)",
available: "24"
)
])
List<ActionModeMenuItem_?> actionModeMenuItem;
@ExchangeableObjectProperty(
serializer: Util.serializeTest,
deserializer: Util.deserializeTest
)
int test = 0;
DateTime? validNotAfterDate;
TestClass_({required String asd, this.test1 = "asdasd", required this.test2,
this.actionModeMenuItem = const [ActionModeMenuItem_.MENU_ITEM_NONE]}) : super(asd: asd);
}
class TestClass3 {
String asd;
TestClass3({required this.asd});
}
class Util {
static String serializeTest(int source) {
return source.toString();
}
static int deserializeTest(String source) {
return int.parse(source);
}
}

View File

@ -0,0 +1,160 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'package:flutter/foundation.dart';
part 'test_enum.g.dart';
typedef myInt = int;
///Docs
@ExchangeableEnum(
bitwiseOrOperator: true
)
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "TestClass",
available: "24",
note: "[test1] is always `null`."
),
EnumIOSPlatform(
apiName: "TestClass",
available: "15.0",
note: "[test2] is always `null`."
),
EnumWebPlatform(),
])
class ActionModeMenuItem_ {
final int _value;
const ActionModeMenuItem_._internal(this._value);
///No menu items should be disabled.
static const MENU_ITEM_NONE = const ActionModeMenuItem_._internal(0);
///Disable menu item "Share".
static const MENU_ITEM_SHARE = const ActionModeMenuItem_._internal(1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = const ActionModeMenuItem_._internal(2);
///Disable all the action mode menu items for text processing.
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "TestClass",
available: "24",
note: "[test1] is always `null`."
),
EnumIOSPlatform(
apiName: "TestClass",
available: "15.0",
note: "[test2] is always `null`."
),
EnumWebPlatform(),
])
static const MENU_ITEM_PROCESS_TEXT = const ActionModeMenuItem_._internal(4);
}
typedef myString = String;
@ExchangeableEnum()
///Class that represents a type of resource used to ask user's permission.
class PermissionResourceType_ {
final String _value;
final dynamic _nativeValue = null;
const PermissionResourceType_._internal(this._value);
///Resource belongs to audio capture device, like microphone.
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "PermissionRequest.RESOURCE_AUDIO_CAPTURE",
apiUrl: "https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_AUDIO_CAPTURE",
value: 'android.webkit.resource.AUDIO_CAPTURE'
),
EnumIOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.microphone",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone",
value: 1
),
EnumMacOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.microphone",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/microphone",
value: 1
),
])
static const MICROPHONE = PermissionResourceType_._internal('MICROPHONE');
///Resource will allow sysex messages to be sent to or received from MIDI devices.
///These messages are privileged operations, e.g. modifying sound libraries and sampling data, or even updating the MIDI device's firmware.
///Permission may be requested for this resource in API levels 21 and above, if the Android device has been updated to WebView 45 or above.
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "PermissionRequest.RESOURCE_MIDI_SYSEX",
apiUrl: "https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_MIDI_SYSEX",
value: 'android.webkit.resource.RESOURCE_MIDI_SYSEX'
)
])
static const MIDI_SYSEX = PermissionResourceType_._internal('MIDI_SYSEX');
///Resource belongs to protected media identifier. After the user grants this resource, the origin can use EME APIs to generate the license requests.
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID",
apiUrl: "https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_PROTECTED_MEDIA_ID",
value: 'android.webkit.resource.PROTECTED_MEDIA_ID'
)
])
static const PROTECTED_MEDIA_ID = PermissionResourceType_._internal('PROTECTED_MEDIA_ID');
///Resource belongs to video capture device, like camera.
@EnumSupportedPlatforms(platforms: [
EnumAndroidPlatform(
apiName: "PermissionRequest.RESOURCE_VIDEO_CAPTURE",
apiUrl: "https://developer.android.com/reference/android/webkit/PermissionRequest#RESOURCE_VIDEO_CAPTURE",
value: 'android.webkit.resource.VIDEO_CAPTURE'
),
EnumIOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.camera",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera",
value: 0
),
EnumMacOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.camera",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/camera",
value: 0
),
])
static const CAMERA = PermissionResourceType_._internal('CAMERA');
///A media device or devices that can capture audio and video.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.cameraAndMicrophone",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone",
value: 2
),
EnumMacOSPlatform(
available: "15.0",
apiName: "WKMediaCaptureType.cameraAndMicrophone",
apiUrl: "https://developer.apple.com/documentation/webkit/wkmediacapturetype/cameraandmicrophone",
value: 2
),
])
static const CAMERA_AND_MICROPHONE = PermissionResourceType_._internal('CAMERA_AND_MICROPHONE');
///Resource belongs to the devices orientation and motion.
@EnumSupportedPlatforms(platforms: [
EnumIOSPlatform(
available: "15.0",
value: 'deviceOrientationAndMotion'
),
EnumMacOSPlatform(
available: "15.0",
value: 'deviceOrientationAndMotion'
),
])
static const DEVICE_ORIENTATION_AND_MOTION = PermissionResourceType_._internal('DEVICE_ORIENTATION_AND_MOTION');
}

View File

@ -0,0 +1,10 @@
library test_gen;
import 'package:test_gen/src/types/test_class.dart';
import 'package:test_gen/src/test/test_class_2.dart';
import 'package:test_gen/src/types/test_enum.dart';
void main() {
TestClass a = TestClass(test1: "test1", test2: TestClass2(test1: "test2"), actionModeMenuItem: ActionModeMenuItem.MENU_ITEM_NONE);
a.toMap();
}

View File

@ -0,0 +1,422 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "39.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.10"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.3"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.1"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "8.3.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.2"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_inappwebview_internal_annotations:
dependency: "direct main"
description:
path: "../flutter_inappwebview_internal_annotations"
relative: true
source: path
version: "1.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
generators:
dependency: "direct dev"
description:
path: "../generators"
relative: true
source: path
version: "1.0.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
io:
dependency: transitive
description:
name: io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.4"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.5.0"
lints:
dependency: "direct dev"
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
web_socket_channel:
dependency: transitive
description:
name: web_socket_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.16.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -0,0 +1,20 @@
name: test_gen
version: 1.0.0
publish_to: none
environment:
sdk: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"
dependencies:
flutter:
sdk: flutter
flutter_inappwebview_internal_annotations:
path: ../flutter_inappwebview_internal_annotations/
dev_dependencies:
build_runner:
generators:
path: ../generators/
lints: ^1.0.1

View File

@ -1,68 +1,27 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'action_mode_menu_item.g.dart';
///Class used to disable the action mode menu items. ///Class used to disable the action mode menu items.
class ActionModeMenuItem { @ExchangeableEnum(
bitwiseOrOperator: true
)
class ActionModeMenuItem_ {
// ignore: unused_field
final int _value; final int _value;
const ActionModeMenuItem_._internal(this._value);
const ActionModeMenuItem._internal(this._value);
///Set of all values of [ActionModeMenuItem].
static final Set<ActionModeMenuItem> values = [
ActionModeMenuItem.MENU_ITEM_NONE,
ActionModeMenuItem.MENU_ITEM_SHARE,
ActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
ActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [ActionModeMenuItem] instance from an [int] value.
static ActionModeMenuItem? fromValue(int? value) {
if (value != null) {
try {
return ActionModeMenuItem.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
// maybe coming from a Bitwise OR operator
return ActionModeMenuItem._internal(value);
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "MENU_ITEM_SHARE";
case 2:
return "MENU_ITEM_WEB_SEARCH";
case 4:
return "MENU_ITEM_PROCESS_TEXT";
case 0:
return "MENU_ITEM_NONE";
}
return _value.toString();
}
///No menu items should be disabled. ///No menu items should be disabled.
static const MENU_ITEM_NONE = const ActionModeMenuItem._internal(0); static const MENU_ITEM_NONE = ActionModeMenuItem_._internal(0);
///Disable menu item "Share". ///Disable menu item "Share".
static const MENU_ITEM_SHARE = const ActionModeMenuItem._internal(1); static const MENU_ITEM_SHARE = ActionModeMenuItem_._internal(1);
///Disable menu item "Web Search". ///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = const ActionModeMenuItem._internal(2); static const MENU_ITEM_WEB_SEARCH = ActionModeMenuItem_._internal(2);
///Disable all the action mode menu items for text processing. ///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT = const ActionModeMenuItem._internal(4); static const MENU_ITEM_PROCESS_TEXT = ActionModeMenuItem_._internal(4);
bool operator ==(value) => value == _value;
ActionModeMenuItem operator |(ActionModeMenuItem value) =>
ActionModeMenuItem._internal(value.toValue() | _value);
@override
int get hashCode => _value.hashCode;
} }
///An Android-specific class used to disable the action mode menu items. ///An Android-specific class used to disable the action mode menu items.
@ -71,70 +30,25 @@ class ActionModeMenuItem {
/// ///
///Use [ActionModeMenuItem] instead. ///Use [ActionModeMenuItem] instead.
@Deprecated("Use ActionModeMenuItem instead") @Deprecated("Use ActionModeMenuItem instead")
class AndroidActionModeMenuItem { @ExchangeableEnum(
bitwiseOrOperator: true
)
class AndroidActionModeMenuItem_ {
// ignore: unused_field
final int _value; final int _value;
const AndroidActionModeMenuItem_._internal(this._value);
const AndroidActionModeMenuItem._internal(this._value);
///Set of all values of [AndroidActionModeMenuItem].
static final Set<AndroidActionModeMenuItem> values = [
AndroidActionModeMenuItem.MENU_ITEM_NONE,
AndroidActionModeMenuItem.MENU_ITEM_SHARE,
AndroidActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
AndroidActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [AndroidActionModeMenuItem] instance from an [int] value.
static AndroidActionModeMenuItem? fromValue(int? value) {
if (value != null) {
try {
return AndroidActionModeMenuItem.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
// maybe coming from a Bitwise OR operator
return AndroidActionModeMenuItem._internal(value);
}
}
return null;
}
///Gets [int] value.
int toValue() => _value;
@override
String toString() {
switch (_value) {
case 1:
return "MENU_ITEM_SHARE";
case 2:
return "MENU_ITEM_WEB_SEARCH";
case 4:
return "MENU_ITEM_PROCESS_TEXT";
case 0:
return "MENU_ITEM_NONE";
}
return _value.toString();
}
///No menu items should be disabled. ///No menu items should be disabled.
static const MENU_ITEM_NONE = const AndroidActionModeMenuItem._internal(0); static const MENU_ITEM_NONE = const AndroidActionModeMenuItem_._internal(0);
///Disable menu item "Share". ///Disable menu item "Share".
static const MENU_ITEM_SHARE = const AndroidActionModeMenuItem._internal(1); static const MENU_ITEM_SHARE = const AndroidActionModeMenuItem_._internal(1);
///Disable menu item "Web Search". ///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = static const MENU_ITEM_WEB_SEARCH =
const AndroidActionModeMenuItem._internal(2); const AndroidActionModeMenuItem_._internal(2);
///Disable all the action mode menu items for text processing. ///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT = static const MENU_ITEM_PROCESS_TEXT =
const AndroidActionModeMenuItem._internal(4); const AndroidActionModeMenuItem_._internal(4);
bool operator ==(value) => value == _value;
AndroidActionModeMenuItem operator |(AndroidActionModeMenuItem value) =>
AndroidActionModeMenuItem._internal(value.toValue() | _value);
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,187 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'action_mode_menu_item.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to disable the action mode menu items.
class ActionModeMenuItem {
final int _value;
final int _nativeValue;
const ActionModeMenuItem._internal(this._value, this._nativeValue);
// ignore: unused_element
factory ActionModeMenuItem._internalMultiPlatform(
int value, Function nativeValue) =>
ActionModeMenuItem._internal(value, nativeValue());
///No menu items should be disabled.
static const MENU_ITEM_NONE = ActionModeMenuItem._internal(0, 0);
///Disable menu item "Share".
static const MENU_ITEM_SHARE = ActionModeMenuItem._internal(1, 1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = ActionModeMenuItem._internal(2, 2);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT = ActionModeMenuItem._internal(4, 4);
///Set of all values of [ActionModeMenuItem].
static final Set<ActionModeMenuItem> values = [
ActionModeMenuItem.MENU_ITEM_NONE,
ActionModeMenuItem.MENU_ITEM_SHARE,
ActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
ActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [ActionModeMenuItem] instance from [int] value.
static ActionModeMenuItem? fromValue(int? value) {
if (value != null) {
try {
return ActionModeMenuItem.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return ActionModeMenuItem._internal(value, value);
}
}
return null;
}
///Gets a possible [ActionModeMenuItem] instance from a native value.
static ActionModeMenuItem? fromNativeValue(int? value) {
if (value != null) {
try {
return ActionModeMenuItem.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return ActionModeMenuItem._internal(value, value);
}
}
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;
ActionModeMenuItem operator |(ActionModeMenuItem value) =>
ActionModeMenuItem._internal(
value.toValue() | _value, value.toNativeValue() | _nativeValue);
@override
String toString() {
switch (_value) {
case 0:
return 'MENU_ITEM_NONE';
case 1:
return 'MENU_ITEM_SHARE';
case 2:
return 'MENU_ITEM_WEB_SEARCH';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
}
return _value.toString();
}
}
///An Android-specific class used to disable the action mode menu items.
///
///**NOTE**: available on Android 24+.
///
///Use [ActionModeMenuItem] instead.
@Deprecated('Use ActionModeMenuItem instead')
class AndroidActionModeMenuItem {
final int _value;
final int _nativeValue;
const AndroidActionModeMenuItem._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidActionModeMenuItem._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidActionModeMenuItem._internal(value, nativeValue());
///No menu items should be disabled.
static const MENU_ITEM_NONE = AndroidActionModeMenuItem._internal(0, 0);
///Disable menu item "Share".
static const MENU_ITEM_SHARE = AndroidActionModeMenuItem._internal(1, 1);
///Disable menu item "Web Search".
static const MENU_ITEM_WEB_SEARCH = AndroidActionModeMenuItem._internal(2, 2);
///Disable all the action mode menu items for text processing.
static const MENU_ITEM_PROCESS_TEXT =
AndroidActionModeMenuItem._internal(4, 4);
///Set of all values of [AndroidActionModeMenuItem].
static final Set<AndroidActionModeMenuItem> values = [
AndroidActionModeMenuItem.MENU_ITEM_NONE,
AndroidActionModeMenuItem.MENU_ITEM_SHARE,
AndroidActionModeMenuItem.MENU_ITEM_WEB_SEARCH,
AndroidActionModeMenuItem.MENU_ITEM_PROCESS_TEXT,
].toSet();
///Gets a possible [AndroidActionModeMenuItem] instance from [int] value.
static AndroidActionModeMenuItem? fromValue(int? value) {
if (value != null) {
try {
return AndroidActionModeMenuItem.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return AndroidActionModeMenuItem._internal(value, value);
}
}
return null;
}
///Gets a possible [AndroidActionModeMenuItem] instance from a native value.
static AndroidActionModeMenuItem? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidActionModeMenuItem.values
.firstWhere((element) => element.toNativeValue() == value);
} catch (e) {
return AndroidActionModeMenuItem._internal(value, value);
}
}
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;
AndroidActionModeMenuItem operator |(AndroidActionModeMenuItem value) =>
AndroidActionModeMenuItem._internal(
value.toValue() | _value, value.toNativeValue() | _nativeValue);
@override
String toString() {
switch (_value) {
case 0:
return 'MENU_ITEM_NONE';
case 1:
return 'MENU_ITEM_SHARE';
case 2:
return 'MENU_ITEM_WEB_SEARCH';
case 4:
return 'MENU_ITEM_PROCESS_TEXT';
}
return _value.toString();
}
}

View File

@ -1,10 +1,15 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request_headers.dart'; import 'ajax_request_headers.dart';
import 'ajax_request_ready_state.dart'; import 'ajax_request_ready_state.dart';
import 'ajax_request_event.dart'; import 'ajax_request_event.dart';
import 'ajax_request_action.dart'; import 'ajax_request_action.dart';
part 'ajax_request.g.dart';
///Class that represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object. ///Class that represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
class AjaxRequest { @ExchangeableObject()
class AjaxRequest_ {
///Data passed as a parameter to the `XMLHttpRequest.send()` method. ///Data passed as a parameter to the `XMLHttpRequest.send()` method.
dynamic data; dynamic data;
@ -30,10 +35,10 @@ class AjaxRequest {
bool? withCredentials; bool? withCredentials;
///The HTTP request headers. ///The HTTP request headers.
AjaxRequestHeaders? headers; AjaxRequestHeaders_? headers;
///The state of the `XMLHttpRequest` request. ///The state of the `XMLHttpRequest` request.
AjaxRequestReadyState? readyState; AjaxRequestReadyState_? readyState;
///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response. ///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response.
int? status; int? status;
@ -67,12 +72,12 @@ class AjaxRequest {
Map<String, dynamic>? responseHeaders; Map<String, dynamic>? responseHeaders;
///Event type of the `XMLHttpRequest` request. ///Event type of the `XMLHttpRequest` request.
AjaxRequestEvent? event; AjaxRequestEvent_? event;
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request. ///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
AjaxRequestAction? action; AjaxRequestAction_? action;
AjaxRequest( AjaxRequest_(
{this.data, {this.data,
this.method, this.method,
this.url, this.url,
@ -91,68 +96,6 @@ class AjaxRequest {
this.statusText, this.statusText,
this.responseHeaders, this.responseHeaders,
this.event, this.event,
this.action = AjaxRequestAction.PROCEED}); this.action = AjaxRequestAction_.PROCEED});
///Gets a possible [AjaxRequest] instance from a [Map] value.
static AjaxRequest? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return 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.fromValue(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"]?.cast<String, dynamic>(),
event: AjaxRequestEvent.fromMap(map["event"]?.cast<String, dynamic>()));
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"method": method,
"url": url?.toString(),
"isAsync": isAsync,
"user": user,
"password": password,
"withCredentials": withCredentials,
"headers": headers?.toMap(),
"readyState": readyState?.toValue(),
"status": status,
"responseURL": responseURL?.toString(),
"responseType": responseType,
"response": response,
"responseText": responseText,
"responseXML": responseXML,
"statusText": statusText,
"responseHeaders": responseHeaders,
"action": action?.toValue()
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,164 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a JavaScript [XMLHttpRequest](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) object.
class AjaxRequest {
///Data passed as a parameter to the `XMLHttpRequest.send()` method.
dynamic data;
///The HTTP request method of the `XMLHttpRequest` request.
String? method;
///The URL of the `XMLHttpRequest` request.
Uri? url;
///An optional Boolean parameter, defaulting to true, indicating whether or not the request is performed asynchronously.
bool? isAsync;
///The optional user name to use for authentication purposes; by default, this is the null value.
String? user;
///The optional password to use for authentication purposes; by default, this is the null value.
String? password;
///The XMLHttpRequest.withCredentials property is a Boolean that indicates whether or not cross-site Access-Control requests
///should be made using credentials such as cookies, authorization headers or TLS client certificates.
///Setting withCredentials has no effect on same-site requests.
///In addition, this flag is also used to indicate when cookies are to be ignored in the response. The default is false.
bool? withCredentials;
///The HTTP request headers.
AjaxRequestHeaders? headers;
///The state of the `XMLHttpRequest` request.
AjaxRequestReadyState? readyState;
///The numerical HTTP [status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) of the `XMLHttpRequest`'s response.
int? status;
///The serialized URL of the response or the empty string if the URL is null.
///If the URL is returned, any URL fragment present in the URL will be stripped away.
///The value of responseURL will be the final URL obtained after any redirects.
Uri? responseURL;
///It is an enumerated string value specifying the type of data contained in the response.
///It also lets the author change the [response type](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
///If an empty string is set as the value of responseType, the default value of text is used.
String? responseType;
///The response's body content. The content-type depends on the [AjaxRequest.reponseType].
dynamic response;
///The text received from a server following a request being sent.
String? responseText;
///The HTML or XML string retrieved by the request or null if the request was unsuccessful, has not yet been sent, or if the data can't be parsed as XML or HTML.
String? responseXML;
///A String containing the response's status message as returned by the HTTP server.
///Unlike [AjaxRequest.status] which indicates a numerical status code, this property contains the text of the response status, such as "OK" or "Not Found".
///If the request's readyState is in [AjaxRequestReadyState.UNSENT] or [AjaxRequestReadyState.OPENED] state, the value of statusText will be an empty string.
///If the server response doesn't explicitly specify a status text, statusText will assume the default value "OK".
String? statusText;
///All the response headers or returns null if no response has been received. If a network error happened, an empty string is returned.
Map<String, dynamic>? responseHeaders;
///Event type of the `XMLHttpRequest` request.
AjaxRequestEvent? event;
///Indicates the [AjaxRequestAction] that can be used to control the `XMLHttpRequest` request.
AjaxRequestAction? action;
AjaxRequest(
{this.data,
this.method,
this.url,
this.isAsync,
this.user,
this.password,
this.withCredentials,
this.headers,
this.readyState,
this.status,
this.responseURL,
this.responseType,
this.response,
this.responseText,
this.responseXML,
this.statusText,
this.responseHeaders,
this.event,
this.action = AjaxRequestAction.PROCEED});
///Gets a possible [AjaxRequest] instance from a [Map] value.
static AjaxRequest? fromMap(Map<String, dynamic>? map) {
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>());
instance.action = AjaxRequestAction.fromNativeValue(map['action']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"data": data,
"method": method,
"url": url?.toString(),
"isAsync": isAsync,
"user": user,
"password": password,
"withCredentials": withCredentials,
"headers": headers?.toMap(),
"readyState": readyState?.toNativeValue(),
"status": status,
"responseURL": responseURL?.toString(),
"responseType": responseType,
"response": response,
"responseText": responseText,
"responseXML": responseXML,
"statusText": statusText,
"responseHeaders": responseHeaders,
"event": event?.toMap(),
"action": action?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'AjaxRequest{data: $data, method: $method, url: $url, isAsync: $isAsync, user: $user, password: $password, withCredentials: $withCredentials, headers: $headers, readyState: $readyState, status: $status, responseURL: $responseURL, responseType: $responseType, response: $response, responseText: $responseText, responseXML: $responseXML, statusText: $statusText, responseHeaders: $responseHeaders, event: $event, action: $action}';
}
}

View File

@ -1,39 +1,19 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request.dart'; import 'ajax_request.dart';
part 'ajax_request_action.g.dart';
///Class used by [AjaxRequest] class. ///Class used by [AjaxRequest] class.
class AjaxRequestAction { @ExchangeableEnum()
class AjaxRequestAction_ {
// ignore: unused_field
final int _value; final int _value;
const AjaxRequestAction_._internal(this._value);
const AjaxRequestAction._internal(this._value);
///Gets [int] value.
int toValue() => _value;
///Aborts the current [AjaxRequest]. ///Aborts the current [AjaxRequest].
static const ABORT = const AjaxRequestAction._internal(0); static const ABORT = const AjaxRequestAction_._internal(0);
///Proceeds with the current [AjaxRequest]. ///Proceeds with the current [AjaxRequest].
static const PROCEED = const AjaxRequestAction._internal(1); static const PROCEED = const AjaxRequestAction_._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();
}
} }

View File

@ -0,0 +1,79 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request_action.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [AjaxRequest] class.
class AjaxRequestAction {
final int _value;
final int _nativeValue;
const AjaxRequestAction._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AjaxRequestAction._internalMultiPlatform(
int value, Function nativeValue) =>
AjaxRequestAction._internal(value, nativeValue());
///Aborts the current [AjaxRequest].
static const ABORT = AjaxRequestAction._internal(0, 0);
///Proceeds with the current [AjaxRequest].
static const PROCEED = AjaxRequestAction._internal(1, 1);
///Set of all values of [AjaxRequestAction].
static final Set<AjaxRequestAction> values = [
AjaxRequestAction.ABORT,
AjaxRequestAction.PROCEED,
].toSet();
///Gets a possible [AjaxRequestAction] instance from [int] value.
static AjaxRequestAction? fromValue(int? value) {
if (value != null) {
try {
return AjaxRequestAction.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AjaxRequestAction] instance from a native value.
static AjaxRequestAction? fromNativeValue(int? value) {
if (value != null) {
try {
return AjaxRequestAction.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,10 +1,15 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request.dart'; import 'ajax_request.dart';
import 'ajax_request_event_type.dart'; import 'ajax_request_event_type.dart';
part 'ajax_request_event.g.dart';
///Class used by [AjaxRequest] class. It represents events measuring progress of an [AjaxRequest]. ///Class used by [AjaxRequest] class. It represents events measuring progress of an [AjaxRequest].
class AjaxRequestEvent { @ExchangeableObject()
class AjaxRequestEvent_ {
///Event type. ///Event type.
AjaxRequestEventType? type; AjaxRequestEventType_? type;
///Is a Boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. ///Is a Boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable.
///In other words, it tells if the progress is measurable or not. ///In other words, it tells if the progress is measurable or not.
@ -19,38 +24,5 @@ class AjaxRequestEvent {
///When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead. ///When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead.
int? total; int? total;
AjaxRequestEvent({this.type, this.lengthComputable, this.loaded, this.total}); AjaxRequestEvent_({this.type, this.lengthComputable, this.loaded, this.total});
///Gets a possible [AjaxRequestEvent] instance from a [Map] value.
static AjaxRequestEvent? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return AjaxRequestEvent(
type: AjaxRequestEventType.fromValue(map["type"]),
lengthComputable: map["lengthComputable"],
loaded: map["loaded"],
total: map["total"]);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type?.toValue(),
"lengthComputable": lengthComputable,
"loaded": loaded,
"total": total,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,60 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request_event.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class used by [AjaxRequest] class. It represents events measuring progress of an [AjaxRequest].
class AjaxRequestEvent {
///Event type.
AjaxRequestEventType? type;
///Is a Boolean flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable.
///In other words, it tells if the progress is measurable or not.
bool? lengthComputable;
///Is an integer representing the amount of work already performed by the underlying process.
///The ratio of work done can be calculated with the property and [AjaxRequestEvent.total].
///When downloading a resource using HTTP, this only represent the part of the content itself, not headers and other overhead.
int? loaded;
///Is an integer representing the total amount of work that the underlying process is in the progress of performing.
///When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead.
int? total;
AjaxRequestEvent({this.type, this.lengthComputable, this.loaded, this.total});
///Gets a possible [AjaxRequestEvent] instance from a [Map] value.
static AjaxRequestEvent? fromMap(Map<String, dynamic>? map) {
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'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"type": type?.toNativeValue(),
"lengthComputable": lengthComputable,
"loaded": loaded,
"total": total,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'AjaxRequestEvent{type: $type, lengthComputable: $lengthComputable, loaded: $loaded, total: $total}';
}
}

View File

@ -1,64 +1,34 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request_event.dart'; import 'ajax_request_event.dart';
part 'ajax_request_event_type.g.dart';
///Class used by [AjaxRequestEvent] class. ///Class used by [AjaxRequestEvent] class.
class AjaxRequestEventType { @ExchangeableEnum()
class AjaxRequestEventType_ {
final String _value; final String _value;
const AjaxRequestEventType_._internal(this._value);
const AjaxRequestEventType._internal(this._value);
///Set of all values of [AjaxRequestEventType].
static final Set<AjaxRequestEventType> values = [
AjaxRequestEventType.LOADSTART,
AjaxRequestEventType.LOAD,
AjaxRequestEventType.LOADEND,
AjaxRequestEventType.PROGRESS,
AjaxRequestEventType.ERROR,
AjaxRequestEventType.ABORT,
AjaxRequestEventType.TIMEOUT,
].toSet();
///Gets a possible [AjaxRequestEventType] instance from a [String] value.
static AjaxRequestEventType? fromValue(String? value) {
if (value != null) {
try {
return AjaxRequestEventType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
String toString() => _value;
///The LOADSTART event is fired when a request has started to load data. ///The LOADSTART event is fired when a request has started to load data.
static const LOADSTART = const AjaxRequestEventType._internal("loadstart"); static const LOADSTART = const AjaxRequestEventType_._internal("loadstart");
///The LOAD event is fired when an `XMLHttpRequest` transaction completes successfully. ///The LOAD event is fired when an `XMLHttpRequest` transaction completes successfully.
static const LOAD = const AjaxRequestEventType._internal("load"); static const LOAD = const AjaxRequestEventType_._internal("load");
///The LOADEND event is fired when a request has completed, whether successfully (after [AjaxRequestEventType.LOAD]) or ///The LOADEND event is fired when a request has completed, whether successfully (after [AjaxRequestEventType.LOAD]) or
///unsuccessfully (after [AjaxRequestEventType.ABORT] or [AjaxRequestEventType.ERROR]). ///unsuccessfully (after [AjaxRequestEventType.ABORT] or [AjaxRequestEventType.ERROR]).
static const LOADEND = const AjaxRequestEventType._internal("loadend"); static const LOADEND = const AjaxRequestEventType_._internal("loadend");
///The PROGRESS event is fired periodically when a request receives more data. ///The PROGRESS event is fired periodically when a request receives more data.
static const PROGRESS = const AjaxRequestEventType._internal("progress"); static const PROGRESS = const AjaxRequestEventType_._internal("progress");
///The ERROR event is fired when the request encountered an error. ///The ERROR event is fired when the request encountered an error.
static const ERROR = const AjaxRequestEventType._internal("error"); static const ERROR = const AjaxRequestEventType_._internal("error");
///The ABORT event is fired when a request has been aborted. ///The ABORT event is fired when a request has been aborted.
static const ABORT = const AjaxRequestEventType._internal("abort"); static const ABORT = const AjaxRequestEventType_._internal("abort");
///The TIMEOUT event is fired when progression is terminated due to preset time expiring. ///The TIMEOUT event is fired when progression is terminated due to preset time expiring.
static const TIMEOUT = const AjaxRequestEventType._internal("timeout"); static const TIMEOUT = const AjaxRequestEventType_._internal("timeout");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,96 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request_event_type.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [AjaxRequestEvent] class.
class AjaxRequestEventType {
final String _value;
final String _nativeValue;
const AjaxRequestEventType._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AjaxRequestEventType._internalMultiPlatform(
String value, Function nativeValue) =>
AjaxRequestEventType._internal(value, nativeValue());
///The LOADSTART event is fired when a request has started to load data.
static const LOADSTART =
AjaxRequestEventType._internal('loadstart', 'loadstart');
///The LOAD event is fired when an `XMLHttpRequest` transaction completes successfully.
static const LOAD = AjaxRequestEventType._internal('load', 'load');
///The LOADEND event is fired when a request has completed, whether successfully (after [AjaxRequestEventType.LOAD]) or
///unsuccessfully (after [AjaxRequestEventType.ABORT] or [AjaxRequestEventType.ERROR]).
static const LOADEND = AjaxRequestEventType._internal('loadend', 'loadend');
///The PROGRESS event is fired periodically when a request receives more data.
static const PROGRESS =
AjaxRequestEventType._internal('progress', 'progress');
///The ERROR event is fired when the request encountered an error.
static const ERROR = AjaxRequestEventType._internal('error', 'error');
///The ABORT event is fired when a request has been aborted.
static const ABORT = AjaxRequestEventType._internal('abort', 'abort');
///The TIMEOUT event is fired when progression is terminated due to preset time expiring.
static const TIMEOUT = AjaxRequestEventType._internal('timeout', 'timeout');
///Set of all values of [AjaxRequestEventType].
static final Set<AjaxRequestEventType> values = [
AjaxRequestEventType.LOADSTART,
AjaxRequestEventType.LOAD,
AjaxRequestEventType.LOADEND,
AjaxRequestEventType.PROGRESS,
AjaxRequestEventType.ERROR,
AjaxRequestEventType.ABORT,
AjaxRequestEventType.TIMEOUT,
].toSet();
///Gets a possible [AjaxRequestEventType] instance from [String] value.
static AjaxRequestEventType? fromValue(String? value) {
if (value != null) {
try {
return AjaxRequestEventType.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AjaxRequestEventType] instance from a native value.
static AjaxRequestEventType? fromNativeValue(String? value) {
if (value != null) {
try {
return AjaxRequestEventType.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,19 +1,25 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request.dart'; import 'ajax_request.dart';
part 'ajax_request_headers.g.dart';
///Class that represents the HTTP headers of an [AjaxRequest]. ///Class that represents the HTTP headers of an [AjaxRequest].
class AjaxRequestHeaders { @ExchangeableObject()
class AjaxRequestHeaders_ {
Map<String, dynamic> _headers; Map<String, dynamic> _headers;
Map<String, dynamic> _newHeaders = {}; Map<String, dynamic> _newHeaders = {};
AjaxRequestHeaders(this._headers); @ExchangeableObjectConstructor()
AjaxRequestHeaders_(this._headers);
///Gets a possible [AjaxRequestHeaders] instance from a [Map] value. ///Gets a possible [AjaxRequestHeaders] instance from a [Map] value.
static AjaxRequestHeaders? fromMap(Map<String, dynamic>? map) { static AjaxRequestHeaders_? fromMap(Map<String, dynamic>? map) {
if (map == null) { if (map == null) {
return null; return null;
} }
return AjaxRequestHeaders(map); return AjaxRequestHeaders_(map);
} }
///Gets the HTTP headers of the [AjaxRequest]. ///Gets the HTTP headers of the [AjaxRequest].
@ -34,13 +40,8 @@ class AjaxRequestHeaders {
return _newHeaders; return _newHeaders;
} }
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override @override
String toString() { String toString() {
return toMap().toString(); return 'AjaxRequestHeaders{headers: $_headers, requestHeaders: $_newHeaders}';
} }
} }

View File

@ -0,0 +1,50 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request_headers.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the HTTP headers of an [AjaxRequest].
class AjaxRequestHeaders {
Map<String, dynamic> _headers;
Map<String, dynamic> _newHeaders = {};
AjaxRequestHeaders(this._headers);
///Gets a possible [AjaxRequestHeaders] instance from a [Map] value.
static AjaxRequestHeaders? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return AjaxRequestHeaders(map);
}
///Gets the HTTP headers of the [AjaxRequest].
Map<String, dynamic> getHeaders() {
return this._headers;
}
///Sets/updates an HTTP header of the [AjaxRequest]. If there is already an existing [header] with the same name, the values are merged into one single request header.
///For security reasons, some headers can only be controlled by the user agent.
///These headers include the [forbidden header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name)
///and [forbidden response header names](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_response_header_name).
void setRequestHeader(String header, String value) {
_newHeaders[header] = value;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return _newHeaders;
}
@override
String toString() {
return 'AjaxRequestHeaders{headers: $_headers, requestHeaders: $_newHeaders}';
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
}

View File

@ -1,70 +1,28 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ajax_request.dart'; import 'ajax_request.dart';
part 'ajax_request_ready_state.g.dart';
///Class used by [AjaxRequest] class. It represents the state of an [AjaxRequest]. ///Class used by [AjaxRequest] class. It represents the state of an [AjaxRequest].
class AjaxRequestReadyState { @ExchangeableEnum()
class AjaxRequestReadyState_ {
// ignore: unused_field
final int _value; final int _value;
const AjaxRequestReadyState_._internal(this._value);
const AjaxRequestReadyState._internal(this._value);
///Set of all values of [AjaxRequestReadyState].
static final Set<AjaxRequestReadyState> values = [
AjaxRequestReadyState.UNSENT,
AjaxRequestReadyState.OPENED,
AjaxRequestReadyState.HEADERS_RECEIVED,
AjaxRequestReadyState.LOADING,
AjaxRequestReadyState.DONE,
].toSet();
///Gets a possible [AjaxRequestReadyState] instance from an [int] value.
static AjaxRequestReadyState? fromValue(int? value) {
if (value != null) {
try {
return AjaxRequestReadyState.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 "OPENED";
case 2:
return "HEADERS_RECEIVED";
case 3:
return "LOADING";
case 4:
return "DONE";
case 0:
default:
return "UNSENT";
}
}
///Client has been created. `XMLHttpRequest.open()` not called yet. ///Client has been created. `XMLHttpRequest.open()` not called yet.
static const UNSENT = const AjaxRequestReadyState._internal(0); static const UNSENT = const AjaxRequestReadyState_._internal(0);
///`XMLHttpRequest.open()` has been called. ///`XMLHttpRequest.open()` has been called.
static const OPENED = const AjaxRequestReadyState._internal(1); static const OPENED = const AjaxRequestReadyState_._internal(1);
///`XMLHttpRequest.send()` has been called, and [AjaxRequest.headers] and [AjaxRequest.status] are available. ///`XMLHttpRequest.send()` has been called, and [AjaxRequest.headers] and [AjaxRequest.status] are available.
static const HEADERS_RECEIVED = const AjaxRequestReadyState._internal(2); static const HEADERS_RECEIVED = const AjaxRequestReadyState_._internal(2);
///Downloading; [AjaxRequest.responseText] holds partial data. ///Downloading; [AjaxRequest.responseText] holds partial data.
static const LOADING = const AjaxRequestReadyState._internal(3); static const LOADING = const AjaxRequestReadyState_._internal(3);
///The operation is complete. ///The operation is complete.
static const DONE = const AjaxRequestReadyState._internal(4); static const DONE = const AjaxRequestReadyState_._internal(4);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,97 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ajax_request_ready_state.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used by [AjaxRequest] class. It represents the state of an [AjaxRequest].
class AjaxRequestReadyState {
final int _value;
final int _nativeValue;
const AjaxRequestReadyState._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AjaxRequestReadyState._internalMultiPlatform(
int value, Function nativeValue) =>
AjaxRequestReadyState._internal(value, nativeValue());
///Client has been created. `XMLHttpRequest.open()` not called yet.
static const UNSENT = AjaxRequestReadyState._internal(0, 0);
///`XMLHttpRequest.open()` has been called.
static const OPENED = AjaxRequestReadyState._internal(1, 1);
///`XMLHttpRequest.send()` has been called, and [AjaxRequest.headers] and [AjaxRequest.status] are available.
static const HEADERS_RECEIVED = AjaxRequestReadyState._internal(2, 2);
///Downloading; [AjaxRequest.responseText] holds partial data.
static const LOADING = AjaxRequestReadyState._internal(3, 3);
///The operation is complete.
static const DONE = AjaxRequestReadyState._internal(4, 4);
///Set of all values of [AjaxRequestReadyState].
static final Set<AjaxRequestReadyState> values = [
AjaxRequestReadyState.UNSENT,
AjaxRequestReadyState.OPENED,
AjaxRequestReadyState.HEADERS_RECEIVED,
AjaxRequestReadyState.LOADING,
AjaxRequestReadyState.DONE,
].toSet();
///Gets a possible [AjaxRequestReadyState] instance from [int] value.
static AjaxRequestReadyState? fromValue(int? value) {
if (value != null) {
try {
return AjaxRequestReadyState.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AjaxRequestReadyState] instance from a native value.
static AjaxRequestReadyState? fromNativeValue(int? value) {
if (value != null) {
try {
return AjaxRequestReadyState.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 'UNSENT';
case 1:
return 'OPENED';
case 2:
return 'HEADERS_RECEIVED';
case 3:
return 'LOADING';
case 4:
return 'DONE';
}
return _value.toString();
}
}

View File

@ -1,13 +1,18 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../pull_to_refresh/main.dart'; import '../pull_to_refresh/main.dart';
import 'underline_style.dart'; import 'underline_style.dart';
import 'attributed_string_text_effect_style.dart'; import 'attributed_string_text_effect_style.dart';
import '../util.dart'; import '../util.dart';
part 'attributed_string.g.dart';
///Class that represents a string with associated attributes ///Class that represents a string with associated attributes
///used by the [PullToRefreshController] and [PullToRefreshSettings] classes. ///used by the [PullToRefreshController] and [PullToRefreshSettings] classes.
class AttributedString { @ExchangeableObject()
class AttributedString_ {
///The characters for the new object. ///The characters for the new object.
String string; String string;
@ -69,7 +74,7 @@ class AttributedString {
/// ///
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [UnderlineStyle]. ///This value indicates whether the text has a line through it and corresponds to one of the constants described in [UnderlineStyle].
///The default value for this attribute is [UnderlineStyle.STYLE_NONE]. ///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? strikethroughStyle; UnderlineStyle_? strikethroughStyle;
///The color of the stroke. ///The color of the stroke.
/// ///
@ -92,7 +97,7 @@ class AttributedString {
/// ///
///The value of this attribute is a [AttributedStringTextEffectStyle] object. ///The value of this attribute is a [AttributedStringTextEffectStyle] object.
///The default value of this property is `null`, indicating no text effect. ///The default value of this property is `null`, indicating no text effect.
AttributedStringTextEffectStyle? textEffect; AttributedStringTextEffectStyle_? textEffect;
///The color of the underline. ///The color of the underline.
/// ///
@ -104,9 +109,9 @@ class AttributedString {
/// ///
///This value indicates whether the text is underlined and corresponds to one of the constants described in [UnderlineStyle]. ///This value indicates whether the text is underlined and corresponds to one of the constants described in [UnderlineStyle].
///The default value for this attribute is [UnderlineStyle.STYLE_NONE]. ///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? underlineStyle; UnderlineStyle_? underlineStyle;
AttributedString({ AttributedString_({
required this.string, required this.string,
this.backgroundColor, this.backgroundColor,
this.baselineOffset, this.baselineOffset,
@ -123,42 +128,14 @@ class AttributedString {
this.underlineColor, this.underlineColor,
this.underlineStyle, this.underlineStyle,
}); });
Map<String, dynamic> toMap() {
return {
"string": this.string,
"backgroundColor": this.backgroundColor?.toHex(),
"baselineOffset": this.baselineOffset,
"expansion": this.expansion,
"foregroundColor": this.foregroundColor?.toHex(),
"kern": this.kern,
"ligature": this.ligature,
"obliqueness": this.obliqueness,
"strikethroughColor": this.strikethroughColor?.toHex(),
"strikethroughStyle": this.strikethroughStyle?.toValue(),
"strokeColor": this.strokeColor?.toHex(),
"strokeWidth": this.strokeWidth,
"textEffect": this.textEffect?.toValue(),
"underlineColor": this.underlineColor?.toHex(),
"underlineStyle": this.underlineStyle?.toValue(),
};
}
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }
///An iOS-specific class that represents a string with associated attributes ///An iOS-specific class that represents a string with associated attributes
///used by the [PullToRefreshController] and [PullToRefreshOptions] classes. ///used by the [PullToRefreshController] and [PullToRefreshOptions] classes.
///Use [AttributedString] instead. ///Use [AttributedString] instead.
@Deprecated("Use AttributedString instead") @Deprecated("Use AttributedString instead")
class IOSNSAttributedString { @ExchangeableObject()
class IOSNSAttributedString_ {
///The characters for the new object. ///The characters for the new object.
String string; String string;
@ -220,7 +197,7 @@ class IOSNSAttributedString {
/// ///
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [IOSNSUnderlineStyle]. ///This value indicates whether the text has a line through it and corresponds to one of the constants described in [IOSNSUnderlineStyle].
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE]. ///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? strikethroughStyle; IOSNSUnderlineStyle_? strikethroughStyle;
///The color of the stroke. ///The color of the stroke.
/// ///
@ -243,7 +220,7 @@ class IOSNSAttributedString {
/// ///
///The value of this attribute is a [IOSNSAttributedStringTextEffectStyle] object. ///The value of this attribute is a [IOSNSAttributedStringTextEffectStyle] object.
///The default value of this property is `null`, indicating no text effect. ///The default value of this property is `null`, indicating no text effect.
IOSNSAttributedStringTextEffectStyle? textEffect; IOSNSAttributedStringTextEffectStyle_? textEffect;
///The color of the underline. ///The color of the underline.
/// ///
@ -255,9 +232,9 @@ class IOSNSAttributedString {
/// ///
///This value indicates whether the text is underlined and corresponds to one of the constants described in [IOSNSUnderlineStyle]. ///This value indicates whether the text is underlined and corresponds to one of the constants described in [IOSNSUnderlineStyle].
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE]. ///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? underlineStyle; IOSNSUnderlineStyle_? underlineStyle;
IOSNSAttributedString({ IOSNSAttributedString_({
required this.string, required this.string,
this.backgroundColor, this.backgroundColor,
this.baselineOffset, this.baselineOffset,
@ -274,35 +251,4 @@ class IOSNSAttributedString {
this.underlineColor, this.underlineColor,
this.underlineStyle, this.underlineStyle,
}); });
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"string": this.string,
"backgroundColor": this.backgroundColor?.toHex(),
"baselineOffset": this.baselineOffset,
"expansion": this.expansion,
"foregroundColor": this.foregroundColor?.toHex(),
"kern": this.kern,
"ligature": this.ligature,
"obliqueness": this.obliqueness,
"strikethroughColor": this.strikethroughColor?.toHex(),
"strikethroughStyle": this.strikethroughStyle?.toValue(),
"strokeColor": this.strokeColor?.toHex(),
"strokeWidth": this.strokeWidth,
"textEffect": this.textEffect?.toValue(),
"underlineColor": this.underlineColor?.toHex(),
"underlineStyle": this.underlineStyle?.toValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,383 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'attributed_string.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a string with associated attributes
///used by the [PullToRefreshController] and [PullToRefreshSettings] classes.
class AttributedString {
///The characters for the new object.
String string;
///The color of the background behind the text.
///
///The value of this attribute is a [Color] object.
///Use this attribute to specify the color of the background area behind the text.
///If you do not specify this attribute, no background color is drawn.
Color? backgroundColor;
///The vertical offset for the position of the text.
///
///The value of this attribute is a number containing a floating point value indicating the characters offset from the baseline, in points.
///The default value is `0`.
double? baselineOffset;
///The expansion factor of the text.
///
///The value of this attribute is a number containing a floating point value indicating the log of the expansion factor to be applied to glyphs.
///The default value is `0`, indicating no expansion.
double? expansion;
///The color of the text.
///
///The value of this attribute is a [Color] object.
///Use this attribute to specify the color of the text during rendering.
///If you do not specify this attribute, the text is rendered in black.
Color? foregroundColor;
///The kerning of the text.
///
///The value of this attribute is a number containing a floating-point value.
///This value specifies the number of points by which to adjust kern-pair characters.
///Kerning prevents unwanted space from occurring between specific characters and depends on the font.
///The value `0` means kerning is disabled. The default value for this attribute is `0`.
double? kern;
///The ligature of the text.
///
///The value of this attribute is a number containing an integer.
///Ligatures cause specific character combinations to be rendered using a single custom glyph that corresponds to those characters.
///The value `0` indicates no ligatures. The value `1` indicates the use of the default ligatures.
///The value `2` indicates the use of all ligatures.
///The default value for this attribute is `1`. (Value `2` is unsupported on iOS.)
int? ligature;
///The obliqueness of the text.
///
///The value of this attribute is a number containing a floating point value indicating skew to be applied to glyphs.
///The default value is `0`, indicating no skew.
double? obliqueness;
///The color of the strikethrough.
///
///The value of this attribute is a [Color] object. The default value is `null`, indicating same as foreground color.
Color? strikethroughColor;
///The strikethrough style of the text.
///
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [UnderlineStyle].
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? strikethroughStyle;
///The color of the stroke.
///
///The value of this parameter is a [Color] object.
///If it is not defined (which is the case by default), it is assumed to be the same as the value of foregroundColor;
///otherwise, it describes the outline color.
Color? strokeColor;
///The width of the stroke.
///
///The value of this attribute is a number containing a floating-point value.
///This value represents the amount to change the stroke width and is specified as a percentage of the font point size.
///Specify `0` (the default) for no additional changes.
///Specify positive values to change the stroke width alone.
///Specify negative values to stroke and fill the text.
///For example, a typical value for outlined text would be `3.0`.
double? strokeWidth;
///The text effect.
///
///The value of this attribute is a [AttributedStringTextEffectStyle] object.
///The default value of this property is `null`, indicating no text effect.
AttributedStringTextEffectStyle? textEffect;
///The color of the underline.
///
///The value of this attribute is a [Color] object.
///The default value is `null`, indicating same as foreground color.
Color? underlineColor;
///The underline style of the text.
///
///This value indicates whether the text is underlined and corresponds to one of the constants described in [UnderlineStyle].
///The default value for this attribute is [UnderlineStyle.STYLE_NONE].
UnderlineStyle? underlineStyle;
AttributedString(
{required this.string,
this.backgroundColor,
this.baselineOffset,
this.expansion,
this.foregroundColor,
this.kern,
this.ligature,
this.obliqueness,
this.strikethroughColor,
this.strikethroughStyle,
this.strokeColor,
this.strokeWidth,
this.textEffect,
this.underlineColor,
this.underlineStyle});
///Gets a possible [AttributedString] instance from a [Map] value.
static AttributedString? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = AttributedString(
string: map['string'],
);
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;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"string": string,
"backgroundColor": backgroundColor?.toHex(),
"baselineOffset": baselineOffset,
"expansion": expansion,
"foregroundColor": foregroundColor?.toHex(),
"kern": kern,
"ligature": ligature,
"obliqueness": obliqueness,
"strikethroughColor": strikethroughColor?.toHex(),
"strikethroughStyle": strikethroughStyle?.toNativeValue(),
"strokeColor": strokeColor?.toHex(),
"strokeWidth": strokeWidth,
"textEffect": textEffect?.toNativeValue(),
"underlineColor": underlineColor?.toHex(),
"underlineStyle": underlineStyle?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'AttributedString{string: $string, backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
}
}
///An iOS-specific class that represents a string with associated attributes
///used by the [PullToRefreshController] and [PullToRefreshOptions] classes.
///Use [AttributedString] instead.
@Deprecated('Use AttributedString instead')
class IOSNSAttributedString {
///The characters for the new object.
String string;
///The color of the background behind the text.
///
///The value of this attribute is a [Color] object.
///Use this attribute to specify the color of the background area behind the text.
///If you do not specify this attribute, no background color is drawn.
Color? backgroundColor;
///The vertical offset for the position of the text.
///
///The value of this attribute is a number containing a floating point value indicating the characters offset from the baseline, in points.
///The default value is `0`.
double? baselineOffset;
///The expansion factor of the text.
///
///The value of this attribute is a number containing a floating point value indicating the log of the expansion factor to be applied to glyphs.
///The default value is `0`, indicating no expansion.
double? expansion;
///The color of the text.
///
///The value of this attribute is a [Color] object.
///Use this attribute to specify the color of the text during rendering.
///If you do not specify this attribute, the text is rendered in black.
Color? foregroundColor;
///The kerning of the text.
///
///The value of this attribute is a number containing a floating-point value.
///This value specifies the number of points by which to adjust kern-pair characters.
///Kerning prevents unwanted space from occurring between specific characters and depends on the font.
///The value `0` means kerning is disabled. The default value for this attribute is `0`.
double? kern;
///The ligature of the text.
///
///The value of this attribute is a number containing an integer.
///Ligatures cause specific character combinations to be rendered using a single custom glyph that corresponds to those characters.
///The value `0` indicates no ligatures. The value `1` indicates the use of the default ligatures.
///The value `2` indicates the use of all ligatures.
///The default value for this attribute is `1`. (Value `2` is unsupported on iOS.)
int? ligature;
///The obliqueness of the text.
///
///The value of this attribute is a number containing a floating point value indicating skew to be applied to glyphs.
///The default value is `0`, indicating no skew.
double? obliqueness;
///The color of the strikethrough.
///
///The value of this attribute is a [Color] object. The default value is `null`, indicating same as foreground color.
Color? strikethroughColor;
///The strikethrough style of the text.
///
///This value indicates whether the text has a line through it and corresponds to one of the constants described in [IOSNSUnderlineStyle].
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? strikethroughStyle;
///The color of the stroke.
///
///The value of this parameter is a [Color] object.
///If it is not defined (which is the case by default), it is assumed to be the same as the value of foregroundColor;
///otherwise, it describes the outline color.
Color? strokeColor;
///The width of the stroke.
///
///The value of this attribute is a number containing a floating-point value.
///This value represents the amount to change the stroke width and is specified as a percentage of the font point size.
///Specify `0` (the default) for no additional changes.
///Specify positive values to change the stroke width alone.
///Specify negative values to stroke and fill the text.
///For example, a typical value for outlined text would be `3.0`.
double? strokeWidth;
///The text effect.
///
///The value of this attribute is a [IOSNSAttributedStringTextEffectStyle] object.
///The default value of this property is `null`, indicating no text effect.
IOSNSAttributedStringTextEffectStyle? textEffect;
///The color of the underline.
///
///The value of this attribute is a [Color] object.
///The default value is `null`, indicating same as foreground color.
Color? underlineColor;
///The underline style of the text.
///
///This value indicates whether the text is underlined and corresponds to one of the constants described in [IOSNSUnderlineStyle].
///The default value for this attribute is [IOSNSUnderlineStyle.STYLE_NONE].
IOSNSUnderlineStyle? underlineStyle;
IOSNSAttributedString(
{required this.string,
this.backgroundColor,
this.baselineOffset,
this.expansion,
this.foregroundColor,
this.kern,
this.ligature,
this.obliqueness,
this.strikethroughColor,
this.strikethroughStyle,
this.strokeColor,
this.strokeWidth,
this.textEffect,
this.underlineColor,
this.underlineStyle});
///Gets a possible [IOSNSAttributedString] instance from a [Map] value.
static IOSNSAttributedString? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = IOSNSAttributedString(
string: map['string'],
);
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;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"string": string,
"backgroundColor": backgroundColor?.toHex(),
"baselineOffset": baselineOffset,
"expansion": expansion,
"foregroundColor": foregroundColor?.toHex(),
"kern": kern,
"ligature": ligature,
"obliqueness": obliqueness,
"strikethroughColor": strikethroughColor?.toHex(),
"strikethroughStyle": strikethroughStyle?.toNativeValue(),
"strokeColor": strokeColor?.toHex(),
"strokeWidth": strokeWidth,
"textEffect": textEffect?.toNativeValue(),
"underlineColor": underlineColor?.toHex(),
"underlineStyle": underlineStyle?.toNativeValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'IOSNSAttributedString{string: $string, backgroundColor: $backgroundColor, baselineOffset: $baselineOffset, expansion: $expansion, foregroundColor: $foregroundColor, kern: $kern, ligature: $ligature, obliqueness: $obliqueness, strikethroughColor: $strikethroughColor, strikethroughStyle: $strikethroughStyle, strokeColor: $strokeColor, strokeWidth: $strokeWidth, textEffect: $textEffect, underlineColor: $underlineColor, underlineStyle: $underlineStyle}';
}
}

View File

@ -1,81 +1,29 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'attributed_string_text_effect_style.g.dart';
///Class that represents the supported proxy types. ///Class that represents the supported proxy types.
class AttributedStringTextEffectStyle { @ExchangeableEnum()
class AttributedStringTextEffectStyle_ {
// ignore: unused_field
final String _value; final String _value;
const AttributedStringTextEffectStyle_._internal(this._value);
const AttributedStringTextEffectStyle._internal(this._value);
///Set of all values of [AttributedStringTextEffectStyle].
static final Set<AttributedStringTextEffectStyle> values = [
AttributedStringTextEffectStyle.LETTERPRESS_STYLE,
].toSet();
///Gets a possible [AttributedStringTextEffectStyle] instance from a [String] value.
static AttributedStringTextEffectStyle? fromValue(String? value) {
if (value != null) {
try {
return AttributedStringTextEffectStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper. ///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
static const LETTERPRESS_STYLE = static const LETTERPRESS_STYLE =
const AttributedStringTextEffectStyle._internal("letterpressStyle"); const AttributedStringTextEffectStyle_._internal("letterpressStyle");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An iOS-specific Class that represents the supported proxy types. ///An iOS-specific Class that represents the supported proxy types.
///Use [AttributedStringTextEffectStyle] instead. ///Use [AttributedStringTextEffectStyle] instead.
@Deprecated("Use AttributedStringTextEffectStyle instead") @Deprecated("Use AttributedStringTextEffectStyle instead")
class IOSNSAttributedStringTextEffectStyle { @ExchangeableEnum()
class IOSNSAttributedStringTextEffectStyle_ {
// ignore: unused_field
final String _value; final String _value;
const IOSNSAttributedStringTextEffectStyle_._internal(this._value);
const IOSNSAttributedStringTextEffectStyle._internal(this._value);
///Set of all values of [IOSNSAttributedStringTextEffectStyle].
static final Set<IOSNSAttributedStringTextEffectStyle> values = [
IOSNSAttributedStringTextEffectStyle.LETTERPRESS_STYLE,
].toSet();
///Gets a possible [IOSNSAttributedStringTextEffectStyle] instance from a [String] value.
static IOSNSAttributedStringTextEffectStyle? fromValue(String? value) {
if (value != null) {
try {
return IOSNSAttributedStringTextEffectStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper. ///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
static const LETTERPRESS_STYLE = static const LETTERPRESS_STYLE =
const IOSNSAttributedStringTextEffectStyle._internal("letterpressStyle"); const IOSNSAttributedStringTextEffectStyle_._internal("letterpressStyle");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,138 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'attributed_string_text_effect_style.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the supported proxy types.
class AttributedStringTextEffectStyle {
final String _value;
final String _nativeValue;
const AttributedStringTextEffectStyle._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory AttributedStringTextEffectStyle._internalMultiPlatform(
String value, Function nativeValue) =>
AttributedStringTextEffectStyle._internal(value, nativeValue());
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
static const LETTERPRESS_STYLE = AttributedStringTextEffectStyle._internal(
'letterpressStyle', 'letterpressStyle');
///Set of all values of [AttributedStringTextEffectStyle].
static final Set<AttributedStringTextEffectStyle> values = [
AttributedStringTextEffectStyle.LETTERPRESS_STYLE,
].toSet();
///Gets a possible [AttributedStringTextEffectStyle] instance from [String] value.
static AttributedStringTextEffectStyle? fromValue(String? value) {
if (value != null) {
try {
return AttributedStringTextEffectStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AttributedStringTextEffectStyle] instance from a native value.
static AttributedStringTextEffectStyle? fromNativeValue(String? value) {
if (value != null) {
try {
return AttributedStringTextEffectStyle.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 that represents the supported proxy types.
///Use [AttributedStringTextEffectStyle] instead.
@Deprecated('Use AttributedStringTextEffectStyle instead')
class IOSNSAttributedStringTextEffectStyle {
final String _value;
final String _nativeValue;
const IOSNSAttributedStringTextEffectStyle._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory IOSNSAttributedStringTextEffectStyle._internalMultiPlatform(
String value, Function nativeValue) =>
IOSNSAttributedStringTextEffectStyle._internal(value, nativeValue());
///A graphical text effect that gives glyphs the appearance of letterpress printing, which involves pressing the type into the paper.
static const LETTERPRESS_STYLE =
IOSNSAttributedStringTextEffectStyle._internal(
'letterpressStyle', 'letterpressStyle');
///Set of all values of [IOSNSAttributedStringTextEffectStyle].
static final Set<IOSNSAttributedStringTextEffectStyle> values = [
IOSNSAttributedStringTextEffectStyle.LETTERPRESS_STYLE,
].toSet();
///Gets a possible [IOSNSAttributedStringTextEffectStyle] instance from [String] value.
static IOSNSAttributedStringTextEffectStyle? fromValue(String? value) {
if (value != null) {
try {
return IOSNSAttributedStringTextEffectStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSNSAttributedStringTextEffectStyle] instance from a native value.
static IOSNSAttributedStringTextEffectStyle? fromNativeValue(String? value) {
if (value != null) {
try {
return IOSNSAttributedStringTextEffectStyle.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,129 +1,47 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'cache_mode.g.dart';
///Class used to override the way the cache is used. ///Class used to override the way the cache is used.
class CacheMode { @ExchangeableEnum()
class CacheMode_ {
// ignore: unused_field
final int _value; final int _value;
const CacheMode_._internal(this._value);
const CacheMode._internal(this._value);
///Set of all values of [CacheMode].
static final Set<CacheMode> values = [
CacheMode.LOAD_DEFAULT,
CacheMode.LOAD_CACHE_ELSE_NETWORK,
CacheMode.LOAD_NO_CACHE,
CacheMode.LOAD_CACHE_ONLY,
].toSet();
///Gets a possible [CacheMode] instance from an [int] value.
static CacheMode? fromValue(int? value) {
if (value != null) {
try {
return CacheMode.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 "LOAD_CACHE_ELSE_NETWORK";
case 2:
return "LOAD_NO_CACHE";
case 3:
return "LOAD_CACHE_ONLY";
case -1:
default:
return "LOAD_DEFAULT";
}
}
///Default cache usage mode. If the navigation type doesn't impose any specific behavior, ///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network. ///use cached resources when they are available and not expired, otherwise load resources from the network.
static const LOAD_DEFAULT = const CacheMode._internal(-1); static const LOAD_DEFAULT = const CacheMode_._internal(-1);
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network. ///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
static const LOAD_CACHE_ELSE_NETWORK = const CacheMode._internal(1); static const LOAD_CACHE_ELSE_NETWORK = const CacheMode_._internal(1);
///Don't use the cache, load from the network. ///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = const CacheMode._internal(2); static const LOAD_NO_CACHE = const CacheMode_._internal(2);
///Don't use the network, load from the cache. ///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = const CacheMode._internal(3); static const LOAD_CACHE_ONLY = const CacheMode_._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An Android-specific class used to override the way the cache is used. ///An Android-specific class used to override the way the cache is used.
///Use [CacheMode] instead. ///Use [CacheMode] instead.
@Deprecated("Use CacheMode instead") @Deprecated("Use CacheMode instead")
class AndroidCacheMode { @ExchangeableEnum()
class AndroidCacheMode_ {
// ignore: unused_field
final int _value; final int _value;
const AndroidCacheMode_._internal(this._value);
const AndroidCacheMode._internal(this._value);
///Set of all values of [AndroidCacheMode].
static final Set<AndroidCacheMode> values = [
AndroidCacheMode.LOAD_DEFAULT,
AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
AndroidCacheMode.LOAD_NO_CACHE,
AndroidCacheMode.LOAD_CACHE_ONLY,
].toSet();
///Gets a possible [AndroidCacheMode] instance from an [int] value.
static AndroidCacheMode? fromValue(int? value) {
if (value != null) {
try {
return AndroidCacheMode.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 "LOAD_CACHE_ELSE_NETWORK";
case 2:
return "LOAD_NO_CACHE";
case 3:
return "LOAD_CACHE_ONLY";
case -1:
default:
return "LOAD_DEFAULT";
}
}
///Default cache usage mode. If the navigation type doesn't impose any specific behavior, ///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network. ///use cached resources when they are available and not expired, otherwise load resources from the network.
static const LOAD_DEFAULT = const AndroidCacheMode._internal(-1); static const LOAD_DEFAULT = const AndroidCacheMode_._internal(-1);
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network. ///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
static const LOAD_CACHE_ELSE_NETWORK = const AndroidCacheMode._internal(1); static const LOAD_CACHE_ELSE_NETWORK = const AndroidCacheMode_._internal(1);
///Don't use the cache, load from the network. ///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = const AndroidCacheMode._internal(2); static const LOAD_NO_CACHE = const AndroidCacheMode_._internal(2);
///Don't use the network, load from the cache. ///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = const AndroidCacheMode._internal(3); static const LOAD_CACHE_ONLY = const AndroidCacheMode_._internal(3);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,178 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'cache_mode.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class used to override the way the cache is used.
class CacheMode {
final int _value;
final int _nativeValue;
const CacheMode._internal(this._value, this._nativeValue);
// ignore: unused_element
factory CacheMode._internalMultiPlatform(int value, Function nativeValue) =>
CacheMode._internal(value, nativeValue());
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network.
static const LOAD_DEFAULT = CacheMode._internal(-1, -1);
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
static const LOAD_CACHE_ELSE_NETWORK = CacheMode._internal(1, 1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = CacheMode._internal(2, 2);
///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = CacheMode._internal(3, 3);
///Set of all values of [CacheMode].
static final Set<CacheMode> values = [
CacheMode.LOAD_DEFAULT,
CacheMode.LOAD_CACHE_ELSE_NETWORK,
CacheMode.LOAD_NO_CACHE,
CacheMode.LOAD_CACHE_ONLY,
].toSet();
///Gets a possible [CacheMode] instance from [int] value.
static CacheMode? fromValue(int? value) {
if (value != null) {
try {
return CacheMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [CacheMode] instance from a native value.
static CacheMode? fromNativeValue(int? value) {
if (value != null) {
try {
return CacheMode.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 -1:
return 'LOAD_DEFAULT';
case 1:
return 'LOAD_CACHE_ELSE_NETWORK';
case 2:
return 'LOAD_NO_CACHE';
case 3:
return 'LOAD_CACHE_ONLY';
}
return _value.toString();
}
}
///An Android-specific class used to override the way the cache is used.
///Use [CacheMode] instead.
@Deprecated('Use CacheMode instead')
class AndroidCacheMode {
final int _value;
final int _nativeValue;
const AndroidCacheMode._internal(this._value, this._nativeValue);
// ignore: unused_element
factory AndroidCacheMode._internalMultiPlatform(
int value, Function nativeValue) =>
AndroidCacheMode._internal(value, nativeValue());
///Default cache usage mode. If the navigation type doesn't impose any specific behavior,
///use cached resources when they are available and not expired, otherwise load resources from the network.
static const LOAD_DEFAULT = AndroidCacheMode._internal(-1, -1);
///Use cached resources when they are available, even if they have expired. Otherwise load resources from the network.
static const LOAD_CACHE_ELSE_NETWORK = AndroidCacheMode._internal(1, 1);
///Don't use the cache, load from the network.
static const LOAD_NO_CACHE = AndroidCacheMode._internal(2, 2);
///Don't use the network, load from the cache.
static const LOAD_CACHE_ONLY = AndroidCacheMode._internal(3, 3);
///Set of all values of [AndroidCacheMode].
static final Set<AndroidCacheMode> values = [
AndroidCacheMode.LOAD_DEFAULT,
AndroidCacheMode.LOAD_CACHE_ELSE_NETWORK,
AndroidCacheMode.LOAD_NO_CACHE,
AndroidCacheMode.LOAD_CACHE_ONLY,
].toSet();
///Gets a possible [AndroidCacheMode] instance from [int] value.
static AndroidCacheMode? fromValue(int? value) {
if (value != null) {
try {
return AndroidCacheMode.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [AndroidCacheMode] instance from a native value.
static AndroidCacheMode? fromNativeValue(int? value) {
if (value != null) {
try {
return AndroidCacheMode.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 -1:
return 'LOAD_DEFAULT';
case 1:
return 'LOAD_CACHE_ELSE_NETWORK';
case 2:
return 'LOAD_NO_CACHE';
case 3:
return 'LOAD_CACHE_ONLY';
}
return _value.toString();
}
}

View File

@ -1,27 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/in_app_webview_controller.dart'; import '../in_app_webview/in_app_webview_controller.dart';
part 'call_async_javascript_result.g.dart';
///Class that represents either a success or a failure, including an associated value in each case for [InAppWebViewController.callAsyncJavaScript]. ///Class that represents either a success or a failure, including an associated value in each case for [InAppWebViewController.callAsyncJavaScript].
class CallAsyncJavaScriptResult { @ExchangeableObject()
class CallAsyncJavaScriptResult_ {
///It contains the success value. ///It contains the success value.
dynamic value; dynamic value;
///It contains the failure value. ///It contains the failure value.
String? error; String? error;
CallAsyncJavaScriptResult({this.value, this.error}); CallAsyncJavaScriptResult_({this.value, this.error});
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {"value": value, "error": error};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,46 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'call_async_javascript_result.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents either a success or a failure, including an associated value in each case for [InAppWebViewController.callAsyncJavaScript].
class CallAsyncJavaScriptResult {
///It contains the success value.
dynamic value;
///It contains the failure value.
String? error;
CallAsyncJavaScriptResult({this.value, this.error});
///Gets a possible [CallAsyncJavaScriptResult] instance from a [Map] value.
static CallAsyncJavaScriptResult? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = CallAsyncJavaScriptResult();
instance.value = map['value'];
instance.error = map['error'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"value": value,
"error": error,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'CallAsyncJavaScriptResult{value: $value, error: $error}';
}
}

View File

@ -1,17 +1,27 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../in_app_webview/webview.dart'; import '../in_app_webview/webview.dart';
import 'url_authentication_challenge.dart'; import 'url_authentication_challenge.dart';
import 'url_protection_space.dart'; import 'url_protection_space.dart';
part 'client_cert_challenge.g.dart';
///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event. ///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
///It provides all the information about the challenge. ///It provides all the information about the challenge.
class ClientCertChallenge extends URLAuthenticationChallenge { @ExchangeableObject()
class ClientCertChallenge_ extends URLAuthenticationChallenge_ {
///Use [principals] instead. ///Use [principals] instead.
@Deprecated('Use principals instead') @Deprecated('Use principals instead')
List<String>? androidPrincipals; List<String>? androidPrincipals;
///The acceptable certificate issuers for the certificate matching the private key. ///The acceptable certificate issuers for the certificate matching the private key.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on Android. AndroidPlatform(
apiName: "ClientCertRequest.getPrincipals",
apiUrl: "https://developer.android.com/reference/android/webkit/ClientCertRequest#getPrincipals()",
available: "21"
)
])
List<String>? principals; List<String>? principals;
///Use [keyTypes] instead. ///Use [keyTypes] instead.
@ -19,36 +29,20 @@ class ClientCertChallenge extends URLAuthenticationChallenge {
List<String>? androidKeyTypes; List<String>? androidKeyTypes;
///Returns the acceptable types of asymmetric keys. ///Returns the acceptable types of asymmetric keys.
/// @SupportedPlatforms(platforms: [
///**NOTE**: available only on Android. AndroidPlatform(
apiName: "ClientCertRequest.getKeyTypes",
apiUrl: "https://developer.android.com/reference/android/webkit/ClientCertRequest#getKeyTypes()",
available: "21"
)
])
List<String>? keyTypes; List<String>? keyTypes;
ClientCertChallenge( ClientCertChallenge_(
{required URLProtectionSpace protectionSpace, {required URLProtectionSpace protectionSpace,
@Deprecated('Use principals instead') this.androidPrincipals, @Deprecated('Use principals instead') this.androidPrincipals,
this.principals, this.principals,
@Deprecated('Use keyTypes instead') this.androidKeyTypes, @Deprecated('Use keyTypes instead') this.androidKeyTypes,
this.keyTypes}) this.keyTypes})
: super(protectionSpace: protectionSpace) { : super(protectionSpace: protectionSpace);
// ignore: deprecated_member_use_from_same_package
this.principals = this.principals ?? this.androidPrincipals;
// ignore: deprecated_member_use_from_same_package
this.keyTypes = this.keyTypes ?? this.androidKeyTypes;
}
///Gets a possible [ClientCertChallenge] instance from a [Map] value.
static ClientCertChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return ClientCertChallenge(
protectionSpace: URLProtectionSpace.fromMap(
map["protectionSpace"].cast<String, dynamic>())!,
// ignore: deprecated_member_use_from_same_package
androidPrincipals: map["principals"]?.cast<String>(),
principals: map["principals"]?.cast<String>(),
// ignore: deprecated_member_use_from_same_package
androidKeyTypes: map["keyTypes"]?.cast<String>(),
keyTypes: map["keyTypes"]?.cast<String>());
}
} }

View File

@ -0,0 +1,75 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'client_cert_challenge.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents the challenge of the [WebView.onReceivedClientCertRequest] event.
///It provides all the information about the challenge.
class ClientCertChallenge extends URLAuthenticationChallenge {
///Use [principals] instead.
@Deprecated('Use principals instead')
List<String>? androidPrincipals;
///The acceptable certificate issuers for the certificate matching the private key.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - ClientCertRequest.getPrincipals](https://developer.android.com/reference/android/webkit/ClientCertRequest#getPrincipals()))
List<String>? principals;
///Use [keyTypes] instead.
@Deprecated('Use keyTypes instead')
List<String>? androidKeyTypes;
///Returns the acceptable types of asymmetric keys.
///
///**Supported Platforms/Implementations**:
///- Android native WebView 21+ ([Official API - ClientCertRequest.getKeyTypes](https://developer.android.com/reference/android/webkit/ClientCertRequest#getKeyTypes()))
List<String>? keyTypes;
ClientCertChallenge(
{@Deprecated('Use principals instead') this.androidPrincipals,
this.principals,
@Deprecated('Use keyTypes instead') this.androidKeyTypes,
this.keyTypes,
dynamic protectionSpace})
: super(protectionSpace: protectionSpace) {
principals = principals ?? androidPrincipals;
keyTypes = keyTypes ?? androidKeyTypes;
}
///Gets a possible [ClientCertChallenge] instance from a [Map] value.
static ClientCertChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = ClientCertChallenge(
protectionSpace: map['protectionSpace'],
);
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,
"principals": principals,
"keyTypes": keyTypes,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'ClientCertChallenge{protectionSpace: $protectionSpace, principals: $principals, keyTypes: $keyTypes}';
}
}

View File

@ -1,162 +1,162 @@
export 'action_mode_menu_item.dart'; export 'action_mode_menu_item.dart' show ActionModeMenuItem, AndroidActionModeMenuItem;
export 'ajax_request.dart'; export 'ajax_request.dart' show AjaxRequest;
export 'ajax_request_action.dart'; export 'ajax_request_action.dart' show AjaxRequestAction;
export 'ajax_request_event.dart'; export 'ajax_request_event.dart' show AjaxRequestEvent;
export 'ajax_request_event_type.dart'; export 'ajax_request_event_type.dart' show AjaxRequestEventType;
export 'ajax_request_headers.dart'; export 'ajax_request_headers.dart' show AjaxRequestHeaders;
export 'ajax_request_ready_state.dart'; export 'ajax_request_ready_state.dart' show AjaxRequestReadyState;
export 'attributed_string.dart'; export 'attributed_string.dart' show AttributedString, IOSNSAttributedString;
export 'attributed_string_text_effect_style.dart'; export 'attributed_string_text_effect_style.dart' show AttributedStringTextEffectStyle, IOSNSAttributedStringTextEffectStyle;
export 'cache_mode.dart'; export 'cache_mode.dart' show CacheMode, AndroidCacheMode;
export 'call_async_javascript_result.dart'; export 'call_async_javascript_result.dart' show CallAsyncJavaScriptResult;
export 'client_cert_challenge.dart'; export 'client_cert_challenge.dart' show ClientCertChallenge;
export 'client_cert_response.dart'; export 'client_cert_response.dart' show ClientCertResponse;
export 'client_cert_response_action.dart'; export 'client_cert_response_action.dart' show ClientCertResponseAction;
export 'compress_format.dart'; export 'compress_format.dart' show CompressFormat;
export 'console_message.dart'; export 'console_message.dart' show ConsoleMessage;
export 'console_message_level.dart'; export 'console_message_level.dart' show ConsoleMessageLevel;
export 'content_blocker_action_type.dart'; export 'content_blocker_action_type.dart' show ContentBlockerActionType;
export 'content_blocker_trigger_load_type.dart'; export 'content_blocker_trigger_load_type.dart' show ContentBlockerTriggerLoadType;
export 'content_blocker_trigger_resource_type.dart'; export 'content_blocker_trigger_resource_type.dart' show ContentBlockerTriggerResourceType;
export 'content_world.dart'; export 'content_world.dart' show ContentWorld;
export 'cookie.dart'; export 'cookie.dart' show Cookie;
export 'create_window_action.dart'; export 'create_window_action.dart' show CreateWindowAction;
export 'cross_origin.dart'; export 'cross_origin.dart' show CrossOrigin;
export 'css_link_html_tag_attributes.dart'; export 'css_link_html_tag_attributes.dart' show CSSLinkHtmlTagAttributes;
export 'custom_scheme_response.dart'; export 'custom_scheme_response.dart' show CustomSchemeResponse;
export 'custom_tabs_share_state.dart'; export 'custom_tabs_share_state.dart' show CustomTabsShareState;
export 'data_detector_types.dart'; export 'data_detector_types.dart' show DataDetectorTypes, IOSWKDataDetectorTypes;
export 'dismiss_button_style.dart'; export 'dismiss_button_style.dart' show DismissButtonStyle, IOSSafariDismissButtonStyle;
export 'download_start_request.dart'; export 'download_start_request.dart' show DownloadStartRequest;
export 'favicon.dart'; export 'favicon.dart' show Favicon;
export 'fetch_request.dart'; export 'fetch_request.dart' show FetchRequest;
export 'fetch_request_action.dart'; export 'fetch_request_action.dart' show FetchRequestAction;
export 'fetch_request_credential.dart'; export 'fetch_request_credential.dart' show FetchRequestCredential;
export 'fetch_request_credential_default.dart'; export 'fetch_request_credential_default.dart' show FetchRequestCredentialDefault;
export 'fetch_request_federated_credential.dart'; export 'fetch_request_federated_credential.dart' show FetchRequestFederatedCredential;
export 'fetch_request_password_credential.dart'; export 'fetch_request_password_credential.dart' show FetchRequestPasswordCredential;
export 'force_dark.dart'; export 'force_dark.dart' show ForceDark, AndroidForceDark;
export 'form_resubmission_action.dart'; export 'force_dark_strategy.dart' show ForceDarkStrategy;
export 'frame_info.dart'; export 'form_resubmission_action.dart' show FormResubmissionAction;
export 'geolocation_permission_show_prompt_response.dart'; export 'frame_info.dart' show FrameInfo, IOSWKFrameInfo;
export 'http_auth_response.dart'; export 'geolocation_permission_show_prompt_response.dart' show GeolocationPermissionShowPromptResponse;
export 'http_auth_response_action.dart'; export 'http_auth_response.dart' show HttpAuthResponse;
export 'http_authentication_challenge.dart'; export 'http_auth_response_action.dart' show HttpAuthResponseAction;
export 'http_cookie_same_site_policy.dart'; export 'http_authentication_challenge.dart' show HttpAuthenticationChallenge;
export 'in_app_webview_hit_test_result.dart'; export 'http_cookie_same_site_policy.dart' show HTTPCookieSameSitePolicy;
export 'in_app_webview_hit_test_result_type.dart'; export 'in_app_webview_hit_test_result.dart' show InAppWebViewHitTestResult;
export 'in_app_webview_initial_data.dart'; export 'in_app_webview_hit_test_result_type.dart' show InAppWebViewHitTestResultType;
export 'in_app_webview_rect.dart'; export 'in_app_webview_initial_data.dart' show InAppWebViewInitialData;
export 'javascript_handler_callback.dart'; export 'in_app_webview_rect.dart' show InAppWebViewRect;
export 'js_alert_request.dart'; export 'javascript_handler_callback.dart' show JavaScriptHandlerCallback;
export 'js_alert_response.dart'; export 'js_alert_request.dart' show JsAlertRequest;
export 'js_alert_response_action.dart'; export 'js_alert_response.dart' show JsAlertResponse;
export 'js_before_unload_request.dart'; export 'js_alert_response_action.dart' show JsAlertResponseAction;
export 'js_before_unload_response.dart'; export 'js_before_unload_request.dart' show JsBeforeUnloadRequest;
export 'js_before_unload_response_action.dart'; export 'js_before_unload_response.dart' show JsBeforeUnloadResponse;
export 'js_confirm_request.dart'; export 'js_before_unload_response_action.dart' show JsBeforeUnloadResponseAction;
export 'js_confirm_response.dart'; export 'js_confirm_request.dart' show JsConfirmRequest;
export 'js_confirm_response_action.dart'; export 'js_confirm_response.dart' show JsConfirmResponse;
export 'js_prompt_request.dart'; export 'js_confirm_response_action.dart' show JsConfirmResponseAction;
export 'js_prompt_response.dart'; export 'js_prompt_request.dart' show JsPromptRequest;
export 'js_prompt_response_action.dart'; export 'js_prompt_response.dart' show JsPromptResponse;
export 'layout_algorithm.dart'; export 'js_prompt_response_action.dart' show JsPromptResponseAction;
export 'layout_in_display_cutout_mode.dart'; export 'layout_algorithm.dart' show LayoutAlgorithm, AndroidLayoutAlgorithm;
export 'loaded_resource.dart'; export 'layout_in_display_cutout_mode.dart' show LayoutInDisplayCutoutMode, AndroidLayoutInDisplayCutoutMode;
export 'login_request.dart'; export 'loaded_resource.dart' show LoadedResource;
export 'media_playback_state.dart'; export 'login_request.dart' show LoginRequest;
export 'meta_tag.dart'; export 'media_capture_state.dart' show MediaCaptureState;
export 'meta_tag_attribute.dart'; export 'media_playback_state.dart' show MediaPlaybackState;
export 'mixed_content_mode.dart'; export 'meta_tag.dart' show MetaTag;
export 'modal_presentation_style.dart'; export 'meta_tag_attribute.dart' show MetaTagAttribute;
export 'modal_transition_style.dart'; export 'mixed_content_mode.dart' show MixedContentMode, AndroidMixedContentMode;
export 'navigation_action.dart'; export 'modal_presentation_style.dart' show ModalPresentationStyle, IOSUIModalPresentationStyle;
export 'navigation_action_policy.dart'; export 'modal_transition_style.dart' show ModalTransitionStyle, IOSUIModalTransitionStyle;
export 'navigation_response.dart'; export 'navigation_action.dart' show NavigationAction;
export 'navigation_response_action.dart'; export 'navigation_action_policy.dart' show NavigationActionPolicy;
export 'navigation_type.dart'; export 'navigation_response.dart' show NavigationResponse, IOSWKNavigationResponse;
export 'on_post_message_callback.dart'; export 'navigation_response_action.dart' show NavigationResponseAction, IOSNavigationResponseAction;
export 'over_scroll_mode.dart'; export 'navigation_type.dart' show NavigationType, IOSWKNavigationType;
export 'pdf_configuration.dart'; export 'on_post_message_callback.dart' show OnPostMessageCallback;
export 'permission_request.dart'; export 'over_scroll_mode.dart' show OverScrollMode, AndroidOverScrollMode;
export 'permission_resource_type.dart'; export 'pdf_configuration.dart' show PDFConfiguration, IOSWKPDFConfiguration;
export 'permission_response.dart'; export 'permission_request.dart' show PermissionRequest;
export 'permission_response_action.dart'; export 'permission_resource_type.dart' show PermissionResourceType;
export 'pull_to_refresh_size.dart'; export 'permission_response.dart' show PermissionResponse, PermissionRequestResponse;
export 'referrer_policy.dart'; export 'permission_response_action.dart' show PermissionResponseAction, PermissionRequestResponseAction;
export 'render_process_gone_detail.dart'; export 'print_job_attributes.dart' show PrintJobAttributes;
export 'renderer_priority.dart'; export 'print_job_color_mode.dart' show PrintJobColorMode;
export 'renderer_priority_policy.dart'; export 'print_job_duplex_mode.dart' show PrintJobDuplexMode;
export 'request_focus_node_href_result.dart'; export 'print_job_info.dart' show PrintJobInfo;
export 'request_image_ref_result.dart'; export 'print_job_media_size.dart' show PrintJobMediaSize;
export 'safe_browsing_response.dart'; export 'print_job_orientation.dart' show PrintJobOrientation;
export 'safe_browsing_response_action.dart'; export 'print_job_output_type.dart' show PrintJobOutputType;
export 'safe_browsing_threat.dart'; export 'print_job_rendering_quality.dart' show PrintJobRenderingQuality;
export 'sandbox.dart'; export 'print_job_resolution.dart' show PrintJobResolution;
export 'screenshot_configuration.dart'; export 'print_job_state.dart' show PrintJobState;
export 'script_html_tag_attributes.dart'; export 'proxy_rule.dart' show ProxyRule;
export 'scrollbar_style.dart'; export 'proxy_scheme_filter.dart' show ProxySchemeFilter;
export 'scrollview_content_inset_adjustment_behavior.dart'; export 'pull_to_refresh_size.dart' show PullToRefreshSize, AndroidPullToRefreshSize;
export 'scrollview_deceleration_rate.dart'; export 'referrer_policy.dart' show ReferrerPolicy;
export 'security_origin.dart'; export 'render_process_gone_detail.dart' show RenderProcessGoneDetail;
export 'selection_granularity.dart'; export 'renderer_priority.dart' show RendererPriority;
export 'server_trust_auth_response.dart'; export 'renderer_priority_policy.dart' show RendererPriorityPolicy;
export 'server_trust_auth_response_action.dart'; export 'request_focus_node_href_result.dart' show RequestFocusNodeHrefResult;
export 'server_trust_challenge.dart'; export 'request_image_ref_result.dart' show RequestImageRefResult;
export 'should_allow_deprecated_tls_action.dart'; export 'safe_browsing_response.dart' show SafeBrowsingResponse;
export 'ssl_certificate.dart'; export 'safe_browsing_response_action.dart' show SafeBrowsingResponseAction;
export 'ssl_certificate_dname.dart'; export 'safe_browsing_threat.dart' show SafeBrowsingThreat;
export 'ssl_error.dart'; export 'sandbox.dart' show Sandbox;
export 'ssl_error_type.dart'; export 'screenshot_configuration.dart' show ScreenshotConfiguration;
export 'trusted_web_activity_default_display_mode.dart'; export 'script_html_tag_attributes.dart' show ScriptHtmlTagAttributes;
export 'trusted_web_activity_display_mode.dart'; export 'scrollbar_style.dart' show ScrollBarStyle, AndroidScrollBarStyle;
export 'trusted_web_activity_immersive_display_mode.dart'; export 'scrollview_content_inset_adjustment_behavior.dart' show ScrollViewContentInsetAdjustmentBehavior, IOSUIScrollViewContentInsetAdjustmentBehavior;
export 'trusted_web_activity_screen_orientation.dart'; export 'scrollview_deceleration_rate.dart' show ScrollViewDecelerationRate, IOSUIScrollViewDecelerationRate;
export 'underline_style.dart'; export 'security_origin.dart' show SecurityOrigin, IOSWKSecurityOrigin;
export 'url_authentication_challenge.dart'; export 'selection_granularity.dart' show SelectionGranularity, IOSWKSelectionGranularity;
export 'url_credential.dart'; export 'server_trust_auth_response.dart' show ServerTrustAuthResponse;
export 'url_credential_persistence.dart'; export 'server_trust_auth_response_action.dart' show ServerTrustAuthResponseAction;
export 'url_protection_space.dart'; export 'server_trust_challenge.dart' show ServerTrustChallenge;
export 'url_protection_space_authentication_method.dart'; export 'should_allow_deprecated_tls_action.dart' show ShouldAllowDeprecatedTLSAction, IOSShouldAllowDeprecatedTLSAction;
export 'url_protection_space_http_auth_credentials.dart'; export 'ssl_certificate.dart' show SslCertificate;
export 'url_protection_space_proxy_type.dart'; export 'ssl_certificate_dname.dart' show SslCertificateDName;
export 'url_request.dart'; export 'ssl_error.dart' show SslError;
export 'url_request_cache_policy.dart'; export 'ssl_error_type.dart' show SslErrorType, AndroidSslError, IOSSslError;
export 'url_request_network_service_type.dart'; export 'trusted_web_activity_default_display_mode.dart' show TrustedWebActivityDefaultDisplayMode;
export 'url_response.dart'; export 'trusted_web_activity_display_mode.dart' show TrustedWebActivityDisplayMode;
export 'user_preferred_content_mode.dart'; export 'trusted_web_activity_immersive_display_mode.dart' show TrustedWebActivityImmersiveDisplayMode;
export 'user_script.dart'; export 'trusted_web_activity_screen_orientation.dart' show TrustedWebActivityScreenOrientation;
export 'user_script_injection_time.dart'; export 'underline_style.dart' show UnderlineStyle, IOSNSUnderlineStyle;
export 'vertical_scrollbar_position.dart'; export 'url_authentication_challenge.dart' show URLAuthenticationChallenge;
export 'web_archive_format.dart'; export 'url_credential.dart' show URLCredential;
export 'web_history.dart'; export 'url_credential_persistence.dart' show URLCredentialPersistence, IOSURLCredentialPersistence;
export 'web_history_item.dart'; export 'url_protection_space.dart' show URLProtectionSpace;
export 'web_message_callback.dart'; export 'url_protection_space_authentication_method.dart' show URLProtectionSpaceAuthenticationMethod, IOSNSURLProtectionSpaceAuthenticationMethod;
export 'web_resource_request.dart'; export 'url_protection_space_http_auth_credentials.dart' show URLProtectionSpaceHttpAuthCredentials;
export 'web_resource_response.dart'; export 'url_protection_space_proxy_type.dart' show URLProtectionSpaceProxyType, IOSNSURLProtectionSpaceProxyType;
export 'web_storage_origin.dart'; export 'url_request.dart' show URLRequest;
export 'web_storage_type.dart'; export 'url_request_attribution.dart' show URLRequestAttribution;
export 'website_data_record.dart'; export 'url_request_cache_policy.dart' show URLRequestCachePolicy, IOSURLRequestCachePolicy;
export 'website_data_type.dart'; export 'url_request_network_service_type.dart' show URLRequestNetworkServiceType, IOSURLRequestNetworkServiceType;
export 'webview_implementation.dart'; export 'url_response.dart' show URLResponse, IOSURLResponse;
export 'webview_package_info.dart'; export 'user_preferred_content_mode.dart' show UserPreferredContentMode;
export 'webview_render_process_action.dart'; export 'user_script.dart' show UserScript;
export 'window_features.dart'; export 'user_script_injection_time.dart' show UserScriptInjectionTime;
export 'web_resource_error.dart'; export 'vertical_scrollbar_position.dart' show VerticalScrollbarPosition, AndroidVerticalScrollbarPosition;
export 'web_resource_error_type.dart'; export 'web_archive_format.dart' show WebArchiveFormat;
export 'media_capture_state.dart'; export 'web_authentication_session_error.dart' show WebAuthenticationSessionError;
export 'proxy_rule.dart'; export 'web_history.dart' show WebHistory;
export 'proxy_scheme_filter.dart'; export 'web_history_item.dart' show WebHistoryItem;
export 'force_dark_strategy.dart'; export 'web_message_callback.dart' show WebMessageCallback;
export 'url_request_attribution.dart'; export 'web_resource_error.dart' show WebResourceError;
export 'web_authentication_session_error.dart'; export 'web_resource_error_type.dart' show WebResourceErrorType;
export 'print_job_info.dart'; export 'web_resource_request.dart' show WebResourceRequest;
export 'print_job_state.dart'; export 'web_resource_response.dart' show WebResourceResponse;
export 'print_job_orientation.dart'; export 'web_storage_origin.dart' show WebStorageOrigin, AndroidWebStorageOrigin;
export 'print_job_rendering_quality.dart'; export 'web_storage_type.dart' show WebStorageType;
export 'print_job_media_size.dart'; export 'website_data_record.dart' show WebsiteDataRecord, IOSWKWebsiteDataRecord;
export 'print_job_color_mode.dart'; export 'website_data_type.dart' show WebsiteDataType, IOSWKWebsiteDataType;
export 'print_job_duplex_mode.dart'; export 'webview_implementation.dart' show WebViewImplementation;
export 'print_job_output_type.dart'; export 'webview_package_info.dart' show WebViewPackageInfo, AndroidWebViewPackageInfo;
export 'print_job_resolution.dart'; export 'webview_render_process_action.dart' show WebViewRenderProcessAction;
export 'print_job_attributes.dart'; export 'window_features.dart' show WindowFeatures, IOSWKWindowFeatures;

View File

@ -1,17 +1,21 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../x509_certificate/x509_certificate.dart'; import '../x509_certificate/x509_certificate.dart';
import '../x509_certificate/asn1_distinguished_names.dart'; import '../x509_certificate/asn1_distinguished_names.dart';
import 'ssl_certificate_dname.dart'; import 'ssl_certificate_dname.dart';
part 'ssl_certificate.g.dart';
///SSL certificate info (certificate details) class. ///SSL certificate info (certificate details) class.
class SslCertificate { @ExchangeableObject()
class SslCertificate_ {
///Name of the entity this certificate is issued by. ///Name of the entity this certificate is issued by.
SslCertificateDName? issuedBy; SslCertificateDName_? issuedBy;
///Name of the entity this certificate is issued to. ///Name of the entity this certificate is issued to.
SslCertificateDName? issuedTo; SslCertificateDName_? issuedTo;
///Not-after date from the validity period. ///Not-after date from the validity period.
DateTime? validNotAfterDate; DateTime? validNotAfterDate;
@ -22,7 +26,7 @@ class SslCertificate {
///The original source certificate, if available. ///The original source certificate, if available.
X509Certificate? x509Certificate; X509Certificate? x509Certificate;
SslCertificate( SslCertificate_(
{this.issuedBy, {this.issuedBy,
this.issuedTo, this.issuedTo,
this.validNotAfterDate, this.validNotAfterDate,
@ -88,25 +92,4 @@ class SslCertificate {
x509Certificate: x509Certificate, x509Certificate: x509Certificate,
); );
} }
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"issuedBy": issuedBy?.toMap(),
"issuedTo": issuedTo?.toMap(),
"validNotAfterDate": validNotAfterDate?.millisecondsSinceEpoch,
"validNotBeforeDate": validNotBeforeDate?.millisecondsSinceEpoch,
"x509Certificate": x509Certificate?.toMap(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,105 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ssl_certificate.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///SSL certificate info (certificate details) class.
class SslCertificate {
///Name of the entity this certificate is issued by.
SslCertificateDName? issuedBy;
///Name of the entity this certificate is issued to.
SslCertificateDName? issuedTo;
///Not-after date from the validity period.
DateTime? validNotAfterDate;
///Not-before date from the validity period.
DateTime? validNotBeforeDate;
///The original source certificate, if available.
X509Certificate? x509Certificate;
SslCertificate(
{this.issuedBy,
this.issuedTo,
this.validNotAfterDate,
this.validNotBeforeDate,
this.x509Certificate});
///Gets a possible [SslCertificate] instance from a [Map] value.
static SslCertificate? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
X509Certificate? x509Certificate;
try {
x509Certificate = X509Certificate.fromData(data: map["x509Certificate"]);
} catch (e, stacktrace) {
print(e);
print(stacktrace);
}
if (defaultTargetPlatform == TargetPlatform.iOS) {
if (x509Certificate != null) {
return SslCertificate(
issuedBy: SslCertificateDName(
CName: x509Certificate.issuer(dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509Certificate.issuerDistinguishedName ?? "",
OName: x509Certificate.issuer(
dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509Certificate.issuer(
dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ??
""),
issuedTo: SslCertificateDName(
CName: x509Certificate.subject(dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509Certificate.subjectDistinguishedName ?? "",
OName: x509Certificate.subject(
dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509Certificate.subject(
dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ??
""),
validNotAfterDate: x509Certificate.notAfter,
validNotBeforeDate: x509Certificate.notBefore,
x509Certificate: x509Certificate);
}
return null;
}
return SslCertificate(
issuedBy: SslCertificateDName.fromMap(
map["issuedBy"]?.cast<String, dynamic>()),
issuedTo: SslCertificateDName.fromMap(
map["issuedTo"]?.cast<String, dynamic>()),
validNotAfterDate:
DateTime.fromMillisecondsSinceEpoch(map["validNotAfterDate"]),
validNotBeforeDate:
DateTime.fromMillisecondsSinceEpoch(map["validNotBeforeDate"]),
x509Certificate: x509Certificate);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"issuedBy": issuedBy?.toMap(),
"issuedTo": issuedTo?.toMap(),
"validNotAfterDate": validNotAfterDate?.millisecondsSinceEpoch,
"validNotBeforeDate": validNotBeforeDate?.millisecondsSinceEpoch,
"x509Certificate": x509Certificate?.toMap(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'SslCertificate{issuedBy: $issuedBy, issuedTo: $issuedTo, validNotAfterDate: $validNotAfterDate, validNotBeforeDate: $validNotBeforeDate, x509Certificate: $x509Certificate}';
}
}

View File

@ -1,62 +1,24 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'ssl_certificate.dart'; import 'ssl_certificate.dart';
part 'ssl_certificate_dname.g.dart';
///Distinguished name helper class. Used by [SslCertificate]. ///Distinguished name helper class. Used by [SslCertificate].
class SslCertificateDName { @ExchangeableObject()
class SslCertificateDName_ {
///Common-name (CN) component of the name ///Common-name (CN) component of the name
// ignore: non_constant_identifier_names
String? CName; String? CName;
///Distinguished name (normally includes CN, O, and OU names) ///Distinguished name (normally includes CN, O, and OU names)
// ignore: non_constant_identifier_names
String? DName; String? DName;
///Organization (O) component of the name ///Organization (O) component of the name
// ignore: non_constant_identifier_names
String? OName; String? OName;
///Organizational Unit (OU) component of the name ///Organizational Unit (OU) component of the name
// ignore: non_constant_identifier_names
String? UName; String? UName;
SslCertificateDName( SslCertificateDName_(
// ignore: non_constant_identifier_names {this.CName = "", this.DName = "", this.OName = "", this.UName = ""});
{this.CName = "",
// ignore: non_constant_identifier_names
this.DName = "",
// ignore: non_constant_identifier_names
this.OName = "",
// ignore: non_constant_identifier_names
this.UName = ""});
///Gets a possible [SslCertificateDName] instance from a [Map] value.
static SslCertificateDName? fromMap(Map<String, dynamic>? map) {
return map != null
? SslCertificateDName(
CName: map["CName"] ?? "",
DName: map["DName"] ?? "",
OName: map["OName"] ?? "",
UName: map["UName"] ?? "",
)
: null;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"CName": CName,
"DName": DName,
"OName": OName,
"UName": UName,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,57 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'ssl_certificate_dname.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Distinguished name helper class. Used by [SslCertificate].
class SslCertificateDName {
///Common-name (CN) component of the name
String? CName;
///Distinguished name (normally includes CN, O, and OU names)
String? DName;
///Organization (O) component of the name
String? OName;
///Organizational Unit (OU) component of the name
String? UName;
SslCertificateDName(
{this.CName = "", this.DName = "", this.OName = "", this.UName = ""});
///Gets a possible [SslCertificateDName] instance from a [Map] value.
static SslCertificateDName? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = SslCertificateDName();
instance.CName = map['CName'];
instance.DName = map['DName'];
instance.OName = map['OName'];
instance.UName = map['UName'];
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"CName": CName,
"DName": DName,
"OName": OName,
"UName": UName,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'SslCertificateDName{CName: $CName, DName: $DName, OName: $OName, UName: $UName}';
}
}

View File

@ -1,187 +1,75 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
part 'underline_style.g.dart';
///Class that represents the constants for the underline style and strikethrough style attribute keys. ///Class that represents the constants for the underline style and strikethrough style attribute keys.
class UnderlineStyle { @ExchangeableEnum()
class UnderlineStyle_ {
// ignore: unused_field
final int _value; final int _value;
const UnderlineStyle_._internal(this._value);
const UnderlineStyle._internal(this._value);
///Set of all values of [UnderlineStyle].
static final Set<UnderlineStyle> values = [
UnderlineStyle.STYLE_NONE,
UnderlineStyle.SINGLE,
UnderlineStyle.THICK,
UnderlineStyle.DOUBLE,
UnderlineStyle.PATTERN_DOT,
UnderlineStyle.PATTERN_DASH,
UnderlineStyle.PATTERN_DASH_DOT,
UnderlineStyle.PATTERN_DASH_DOT_DOT,
UnderlineStyle.BY_WORD,
].toSet();
///Gets a possible [UnderlineStyle] instance from an [int] value.
static UnderlineStyle? fromValue(int? value) {
if (value != null) {
try {
return UnderlineStyle.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 "SINGLE";
case 2:
return "THICK";
case 9:
return "DOUBLE";
case 256:
return "PATTERN_DOT";
case 512:
return "PATTERN_DASH";
case 768:
return "PATTERN_DASH_DOT";
case 1024:
return "PATTERN_DASH_DOT_DOT";
case 32768:
return "BY_WORD";
case 0:
default:
return "STYLE_NONE";
}
}
///Do not draw a line. ///Do not draw a line.
static const STYLE_NONE = const UnderlineStyle._internal(0); static const STYLE_NONE = const UnderlineStyle_._internal(0);
///Draw a single line. ///Draw a single line.
static const SINGLE = const UnderlineStyle._internal(1); static const SINGLE = const UnderlineStyle_._internal(1);
///Draw a thick line. ///Draw a thick line.
static const THICK = const UnderlineStyle._internal(2); static const THICK = const UnderlineStyle_._internal(2);
///Draw a double line. ///Draw a double line.
static const DOUBLE = const UnderlineStyle._internal(9); static const DOUBLE = const UnderlineStyle_._internal(9);
///Draw a line of dots. ///Draw a line of dots.
static const PATTERN_DOT = const UnderlineStyle._internal(256); static const PATTERN_DOT = const UnderlineStyle_._internal(256);
///Draw a line of dashes. ///Draw a line of dashes.
static const PATTERN_DASH = const UnderlineStyle._internal(512); static const PATTERN_DASH = const UnderlineStyle_._internal(512);
///Draw a line of alternating dashes and dots. ///Draw a line of alternating dashes and dots.
static const PATTERN_DASH_DOT = const UnderlineStyle._internal(768); static const PATTERN_DASH_DOT = const UnderlineStyle_._internal(768);
///Draw a line of alternating dashes and two dots. ///Draw a line of alternating dashes and two dots.
static const PATTERN_DASH_DOT_DOT = const UnderlineStyle._internal(1024); static const PATTERN_DASH_DOT_DOT = const UnderlineStyle_._internal(1024);
///Draw the line only beneath or through words, not whitespace. ///Draw the line only beneath or through words, not whitespace.
static const BY_WORD = const UnderlineStyle._internal(32768); static const BY_WORD = const UnderlineStyle_._internal(32768);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An iOS-specific Class that represents the constants for the underline style and strikethrough style attribute keys. ///An iOS-specific Class that represents the constants for the underline style and strikethrough style attribute keys.
///Use [UnderlineStyle] instead. ///Use [UnderlineStyle] instead.
@Deprecated("Use UnderlineStyle instead") @Deprecated("Use UnderlineStyle instead")
class IOSNSUnderlineStyle { @ExchangeableEnum()
class IOSNSUnderlineStyle_ {
// ignore: unused_field
final int _value; final int _value;
const IOSNSUnderlineStyle_._internal(this._value);
const IOSNSUnderlineStyle._internal(this._value);
///Set of all values of [IOSNSUnderlineStyle].
static final Set<IOSNSUnderlineStyle> values = [
IOSNSUnderlineStyle.STYLE_NONE,
IOSNSUnderlineStyle.SINGLE,
IOSNSUnderlineStyle.THICK,
IOSNSUnderlineStyle.DOUBLE,
IOSNSUnderlineStyle.PATTERN_DOT,
IOSNSUnderlineStyle.PATTERN_DASH,
IOSNSUnderlineStyle.PATTERN_DASH_DOT,
IOSNSUnderlineStyle.PATTERN_DASH_DOT_DOT,
IOSNSUnderlineStyle.BY_WORD,
].toSet();
///Gets a possible [IOSNSUnderlineStyle] instance from an [int] value.
static IOSNSUnderlineStyle? fromValue(int? value) {
if (value != null) {
try {
return IOSNSUnderlineStyle.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 "SINGLE";
case 2:
return "THICK";
case 9:
return "DOUBLE";
case 256:
return "PATTERN_DOT";
case 512:
return "PATTERN_DASH";
case 768:
return "PATTERN_DASH_DOT";
case 1024:
return "PATTERN_DASH_DOT_DOT";
case 32768:
return "BY_WORD";
case 0:
default:
return "STYLE_NONE";
}
}
///Do not draw a line. ///Do not draw a line.
static const STYLE_NONE = const IOSNSUnderlineStyle._internal(0); static const STYLE_NONE = const IOSNSUnderlineStyle_._internal(0);
///Draw a single line. ///Draw a single line.
static const SINGLE = const IOSNSUnderlineStyle._internal(1); static const SINGLE = const IOSNSUnderlineStyle_._internal(1);
///Draw a thick line. ///Draw a thick line.
static const THICK = const IOSNSUnderlineStyle._internal(2); static const THICK = const IOSNSUnderlineStyle_._internal(2);
///Draw a double line. ///Draw a double line.
static const DOUBLE = const IOSNSUnderlineStyle._internal(9); static const DOUBLE = const IOSNSUnderlineStyle_._internal(9);
///Draw a line of dots. ///Draw a line of dots.
static const PATTERN_DOT = const IOSNSUnderlineStyle._internal(256); static const PATTERN_DOT = const IOSNSUnderlineStyle_._internal(256);
///Draw a line of dashes. ///Draw a line of dashes.
static const PATTERN_DASH = const IOSNSUnderlineStyle._internal(512); static const PATTERN_DASH = const IOSNSUnderlineStyle_._internal(512);
///Draw a line of alternating dashes and dots. ///Draw a line of alternating dashes and dots.
static const PATTERN_DASH_DOT = const IOSNSUnderlineStyle._internal(768); static const PATTERN_DASH_DOT = const IOSNSUnderlineStyle_._internal(768);
///Draw a line of alternating dashes and two dots. ///Draw a line of alternating dashes and two dots.
static const PATTERN_DASH_DOT_DOT = const IOSNSUnderlineStyle._internal(1024); static const PATTERN_DASH_DOT_DOT = const IOSNSUnderlineStyle_._internal(1024);
///Draw the line only beneath or through words, not whitespace. ///Draw the line only beneath or through words, not whitespace.
static const BY_WORD = const IOSNSUnderlineStyle._internal(32768); static const BY_WORD = const IOSNSUnderlineStyle_._internal(32768);
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,237 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'underline_style.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the constants for the underline style and strikethrough style attribute keys.
class UnderlineStyle {
final int _value;
final int _nativeValue;
const UnderlineStyle._internal(this._value, this._nativeValue);
// ignore: unused_element
factory UnderlineStyle._internalMultiPlatform(
int value, Function nativeValue) =>
UnderlineStyle._internal(value, nativeValue());
///Do not draw a line.
static const STYLE_NONE = UnderlineStyle._internal(0, 0);
///Draw a single line.
static const SINGLE = UnderlineStyle._internal(1, 1);
///Draw a thick line.
static const THICK = UnderlineStyle._internal(2, 2);
///Draw a double line.
static const DOUBLE = UnderlineStyle._internal(9, 9);
///Draw a line of dots.
static const PATTERN_DOT = UnderlineStyle._internal(256, 256);
///Draw a line of dashes.
static const PATTERN_DASH = UnderlineStyle._internal(512, 512);
///Draw a line of alternating dashes and dots.
static const PATTERN_DASH_DOT = UnderlineStyle._internal(768, 768);
///Draw a line of alternating dashes and two dots.
static const PATTERN_DASH_DOT_DOT = UnderlineStyle._internal(1024, 1024);
///Draw the line only beneath or through words, not whitespace.
static const BY_WORD = UnderlineStyle._internal(32768, 32768);
///Set of all values of [UnderlineStyle].
static final Set<UnderlineStyle> values = [
UnderlineStyle.STYLE_NONE,
UnderlineStyle.SINGLE,
UnderlineStyle.THICK,
UnderlineStyle.DOUBLE,
UnderlineStyle.PATTERN_DOT,
UnderlineStyle.PATTERN_DASH,
UnderlineStyle.PATTERN_DASH_DOT,
UnderlineStyle.PATTERN_DASH_DOT_DOT,
UnderlineStyle.BY_WORD,
].toSet();
///Gets a possible [UnderlineStyle] instance from [int] value.
static UnderlineStyle? fromValue(int? value) {
if (value != null) {
try {
return UnderlineStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [UnderlineStyle] instance from a native value.
static UnderlineStyle? fromNativeValue(int? value) {
if (value != null) {
try {
return UnderlineStyle.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 'STYLE_NONE';
case 1:
return 'SINGLE';
case 2:
return 'THICK';
case 9:
return 'DOUBLE';
case 256:
return 'PATTERN_DOT';
case 512:
return 'PATTERN_DASH';
case 768:
return 'PATTERN_DASH_DOT';
case 1024:
return 'PATTERN_DASH_DOT_DOT';
case 32768:
return 'BY_WORD';
}
return _value.toString();
}
}
///An iOS-specific Class that represents the constants for the underline style and strikethrough style attribute keys.
///Use [UnderlineStyle] instead.
@Deprecated('Use UnderlineStyle instead')
class IOSNSUnderlineStyle {
final int _value;
final int _nativeValue;
const IOSNSUnderlineStyle._internal(this._value, this._nativeValue);
// ignore: unused_element
factory IOSNSUnderlineStyle._internalMultiPlatform(
int value, Function nativeValue) =>
IOSNSUnderlineStyle._internal(value, nativeValue());
///Do not draw a line.
static const STYLE_NONE = IOSNSUnderlineStyle._internal(0, 0);
///Draw a single line.
static const SINGLE = IOSNSUnderlineStyle._internal(1, 1);
///Draw a thick line.
static const THICK = IOSNSUnderlineStyle._internal(2, 2);
///Draw a double line.
static const DOUBLE = IOSNSUnderlineStyle._internal(9, 9);
///Draw a line of dots.
static const PATTERN_DOT = IOSNSUnderlineStyle._internal(256, 256);
///Draw a line of dashes.
static const PATTERN_DASH = IOSNSUnderlineStyle._internal(512, 512);
///Draw a line of alternating dashes and dots.
static const PATTERN_DASH_DOT = IOSNSUnderlineStyle._internal(768, 768);
///Draw a line of alternating dashes and two dots.
static const PATTERN_DASH_DOT_DOT = IOSNSUnderlineStyle._internal(1024, 1024);
///Draw the line only beneath or through words, not whitespace.
static const BY_WORD = IOSNSUnderlineStyle._internal(32768, 32768);
///Set of all values of [IOSNSUnderlineStyle].
static final Set<IOSNSUnderlineStyle> values = [
IOSNSUnderlineStyle.STYLE_NONE,
IOSNSUnderlineStyle.SINGLE,
IOSNSUnderlineStyle.THICK,
IOSNSUnderlineStyle.DOUBLE,
IOSNSUnderlineStyle.PATTERN_DOT,
IOSNSUnderlineStyle.PATTERN_DASH,
IOSNSUnderlineStyle.PATTERN_DASH_DOT,
IOSNSUnderlineStyle.PATTERN_DASH_DOT_DOT,
IOSNSUnderlineStyle.BY_WORD,
].toSet();
///Gets a possible [IOSNSUnderlineStyle] instance from [int] value.
static IOSNSUnderlineStyle? fromValue(int? value) {
if (value != null) {
try {
return IOSNSUnderlineStyle.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSNSUnderlineStyle] instance from a native value.
static IOSNSUnderlineStyle? fromNativeValue(int? value) {
if (value != null) {
try {
return IOSNSUnderlineStyle.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 'STYLE_NONE';
case 1:
return 'SINGLE';
case 2:
return 'THICK';
case 9:
return 'DOUBLE';
case 256:
return 'PATTERN_DOT';
case 512:
return 'PATTERN_DASH';
case 768:
return 'PATTERN_DASH_DOT';
case 1024:
return 'PATTERN_DASH_DOT_DOT';
case 32768:
return 'BY_WORD';
}
return _value.toString();
}
}

View File

@ -1,40 +1,17 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_protection_space.dart'; import 'url_protection_space.dart';
part 'url_authentication_challenge.g.dart';
///Class that represents a challenge from a server requiring authentication from the client. ///Class that represents a challenge from a server requiring authentication from the client.
///It provides all the information about the challenge. ///It provides all the information about the challenge.
class URLAuthenticationChallenge { @ExchangeableObject()
class URLAuthenticationChallenge_ {
///The protection space requiring authentication. ///The protection space requiring authentication.
URLProtectionSpace protectionSpace; URLProtectionSpace protectionSpace;
URLAuthenticationChallenge({ URLAuthenticationChallenge_({
required this.protectionSpace, required this.protectionSpace,
}); });
///Gets a possible [URLAuthenticationChallenge] instance from a [Map] value.
static URLAuthenticationChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
return URLAuthenticationChallenge(
protectionSpace: URLProtectionSpace.fromMap(
map["protectionSpace"].cast<String, dynamic>())!,
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace.toMap(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,43 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_authentication_challenge.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a challenge from a server requiring authentication from the client.
///It provides all the information about the challenge.
class URLAuthenticationChallenge {
///The protection space requiring authentication.
dynamic protectionSpace;
URLAuthenticationChallenge({this.protectionSpace});
///Gets a possible [URLAuthenticationChallenge] instance from a [Map] value.
static URLAuthenticationChallenge? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = URLAuthenticationChallenge(
protectionSpace: map['protectionSpace'],
);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"protectionSpace": protectionSpace,
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'URLAuthenticationChallenge{protectionSpace: $protectionSpace}';
}
}

View File

@ -1,13 +1,35 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import '../x509_certificate/x509_certificate.dart'; import '../x509_certificate/x509_certificate.dart';
import 'url_protection_space_proxy_type.dart'; import 'url_protection_space_proxy_type.dart';
import 'url_protection_space_authentication_method.dart'; import 'url_protection_space_authentication_method.dart';
import 'ssl_error.dart'; import 'ssl_error.dart';
import 'ssl_certificate.dart'; import 'ssl_certificate.dart';
part 'url_protection_space.g.dart';
List<X509Certificate>? _distinguishedNamesDeserializer(dynamic value) {
List<X509Certificate>? distinguishedNames;
if (value != null) {
distinguishedNames = <X509Certificate>[];
(value.cast<Uint8List>() as List<Uint8List>)
.forEach((data) {
try {
distinguishedNames!.add(X509Certificate.fromData(data: data));
} catch (e, stacktrace) {
print(e);
print(stacktrace);
}
});
}
return distinguishedNames;
}
///Class that represents a protection space requiring authentication. ///Class that represents a protection space requiring authentication.
class URLProtectionSpace { @ExchangeableObject()
class URLProtectionSpace_ {
///The hostname of the server. ///The hostname of the server.
String host; String host;
@ -23,22 +45,25 @@ class URLProtectionSpace {
int? port; int? port;
///The SSL certificate used. ///The SSL certificate used.
SslCertificate? sslCertificate; SslCertificate_? sslCertificate;
///The SSL Error associated. ///The SSL Error associated.
SslError? sslError; SslError? sslError;
///Use [authenticationMethod] instead. ///Use [authenticationMethod] instead.
@Deprecated("Use authenticationMethod instead") @Deprecated("Use authenticationMethod instead")
IOSNSURLProtectionSpaceAuthenticationMethod? iosAuthenticationMethod; IOSNSURLProtectionSpaceAuthenticationMethod_? iosAuthenticationMethod;
///The authentication method used by the receiver. ///The authentication method used by the receiver.
/// ///
///**NOTE**: available only on iOS. ///**NOTE**: available only on iOS.
URLProtectionSpaceAuthenticationMethod? authenticationMethod; URLProtectionSpaceAuthenticationMethod_? authenticationMethod;
///Use [distinguishedNames] instead. ///Use [distinguishedNames] instead.
@Deprecated("Use distinguishedNames instead") @Deprecated("Use distinguishedNames instead")
@ExchangeableObjectProperty(
deserializer: _distinguishedNamesDeserializer
)
List<X509Certificate>? iosDistinguishedNames; List<X509Certificate>? iosDistinguishedNames;
///The acceptable certificate-issuing authorities for client certificate authentication. ///The acceptable certificate-issuing authorities for client certificate authentication.
@ -46,6 +71,9 @@ class URLProtectionSpace {
///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER). ///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER).
/// ///
///**NOTE**: available only on iOS. ///**NOTE**: available only on iOS.
@ExchangeableObjectProperty(
deserializer: _distinguishedNamesDeserializer
)
List<X509Certificate>? distinguishedNames; List<X509Certificate>? distinguishedNames;
///Use [receivesCredentialSecurely] instead. ///Use [receivesCredentialSecurely] instead.
@ -78,7 +106,7 @@ class URLProtectionSpace {
///**NOTE**: available only on iOS. ///**NOTE**: available only on iOS.
URLProtectionSpaceProxyType? proxyType; URLProtectionSpaceProxyType? proxyType;
URLProtectionSpace( URLProtectionSpace_(
{required this.host, {required this.host,
this.protocol, this.protocol,
this.realm, this.realm,
@ -99,121 +127,5 @@ class URLProtectionSpace {
this.isProxy, this.isProxy,
@Deprecated("Use proxyType instead") @Deprecated("Use proxyType instead")
this.iosProxyType, this.iosProxyType,
this.proxyType}) { this.proxyType});
this.authenticationMethod = this.authenticationMethod ??
URLProtectionSpaceAuthenticationMethod.fromValue(
// ignore: deprecated_member_use_from_same_package
this.iosAuthenticationMethod?.toValue());
this.distinguishedNames =
// ignore: deprecated_member_use_from_same_package
this.distinguishedNames ?? this.iosDistinguishedNames;
this.receivesCredentialSecurely =
// ignore: deprecated_member_use_from_same_package
this.receivesCredentialSecurely ?? this.iosReceivesCredentialSecurely;
// ignore: deprecated_member_use_from_same_package
this.isProxy = this.isProxy ?? this.iosIsProxy;
this.proxyType = this.proxyType ??
// ignore: deprecated_member_use_from_same_package
URLProtectionSpaceProxyType.fromValue(this.iosProxyType?.toValue());
}
///Gets a possible [URLProtectionSpace] instance from a [Map] value.
static URLProtectionSpace? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
List<X509Certificate>? distinguishedNames;
if (map["distinguishedNames"] != null) {
distinguishedNames = <X509Certificate>[];
(map["distinguishedNames"].cast<Uint8List>() as List<Uint8List>)
.forEach((data) {
try {
distinguishedNames!.add(X509Certificate.fromData(data: data));
} catch (e, stacktrace) {
print(e);
print(stacktrace);
}
});
}
return URLProtectionSpace(
host: map["host"],
protocol: map["protocol"],
realm: map["realm"],
port: map["port"],
sslCertificate: SslCertificate.fromMap(
map["sslCertificate"]?.cast<String, dynamic>()),
sslError: SslError.fromMap(map["sslError"]?.cast<String, dynamic>()),
// ignore: deprecated_member_use_from_same_package
iosAuthenticationMethod:
// ignore: deprecated_member_use_from_same_package
IOSNSURLProtectionSpaceAuthenticationMethod.fromValue(
map["authenticationMethod"]),
authenticationMethod: URLProtectionSpaceAuthenticationMethod.fromValue(
map["authenticationMethod"]),
// ignore: deprecated_member_use_from_same_package
iosDistinguishedNames: distinguishedNames,
distinguishedNames: distinguishedNames,
// ignore: deprecated_member_use_from_same_package
iosReceivesCredentialSecurely: map["receivesCredentialSecurely"],
receivesCredentialSecurely: map["receivesCredentialSecurely"],
// ignore: deprecated_member_use_from_same_package
iosIsProxy: map["isProxy"],
isProxy: map["isProxy"],
// ignore: deprecated_member_use_from_same_package
iosProxyType:
// ignore: deprecated_member_use_from_same_package
IOSNSURLProtectionSpaceProxyType.fromValue(map["proxyType"]),
proxyType: URLProtectionSpaceProxyType.fromValue(map["proxyType"]),
);
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"host": host,
"protocol": protocol,
"realm": realm,
"port": port,
"sslCertificate": sslCertificate?.toMap(),
"sslError": sslError?.toMap(),
"iosAuthenticationMethod":
// ignore: deprecated_member_use_from_same_package
authenticationMethod ?? iosAuthenticationMethod,
// ignore: deprecated_member_use_from_same_package
"authenticationMethod": authenticationMethod ?? iosAuthenticationMethod,
// ignore: deprecated_member_use_from_same_package
"iosDistinguishedNames": (distinguishedNames ?? iosDistinguishedNames)
?.map((e) => e.toMap())
.toList(),
// ignore: deprecated_member_use_from_same_package
"distinguishedNames": (distinguishedNames ?? iosDistinguishedNames)
?.map((e) => e.toMap())
.toList(),
"iosReceivesCredentialSecurely":
// ignore: deprecated_member_use_from_same_package
receivesCredentialSecurely ?? iosReceivesCredentialSecurely,
"receivesCredentialSecurely":
// ignore: deprecated_member_use_from_same_package
receivesCredentialSecurely ?? iosReceivesCredentialSecurely,
// ignore: deprecated_member_use_from_same_package
"iosIsProxy": isProxy ?? iosIsProxy,
// ignore: deprecated_member_use_from_same_package
"isProxy": isProxy ?? iosIsProxy,
// ignore: deprecated_member_use_from_same_package
"iosProxyType": proxyType?.toValue() ?? iosProxyType?.toValue(),
// ignore: deprecated_member_use_from_same_package
"proxyType": proxyType?.toValue() ?? iosProxyType?.toValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return this.toMap();
}
@override
String toString() {
return toMap().toString();
}
} }

View File

@ -0,0 +1,175 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_protection_space.dart';
// **************************************************************************
// ExchangeableObjectGenerator
// **************************************************************************
///Class that represents a protection space requiring authentication.
class URLProtectionSpace {
///The hostname of the server.
String host;
///The protocol of the server - e.g. "http", "ftp", "https".
String? protocol;
///A string indicating a protocol-specific subdivision of a single host.
///For http and https, this maps to the realm string in http authentication challenges.
///For many other protocols it is unused.
String? realm;
///The port of the server.
int? port;
///The SSL certificate used.
SslCertificate? sslCertificate;
///The SSL Error associated.
SslError? sslError;
///Use [authenticationMethod] instead.
@Deprecated('Use authenticationMethod instead')
IOSNSURLProtectionSpaceAuthenticationMethod? iosAuthenticationMethod;
///The authentication method used by the receiver.
///
///**NOTE**: available only on iOS.
URLProtectionSpaceAuthenticationMethod? authenticationMethod;
///Use [distinguishedNames] instead.
@Deprecated('Use distinguishedNames instead')
List<X509Certificate>? iosDistinguishedNames;
///The acceptable certificate-issuing authorities for client certificate authentication.
///This value is `null` if the authentication method of the protection space is not client certificate.
///The returned issuing authorities are encoded with Distinguished Encoding Rules (DER).
///
///**NOTE**: available only on iOS.
List<X509Certificate>? distinguishedNames;
///Use [receivesCredentialSecurely] instead.
@Deprecated('Use receivesCredentialSecurely instead')
bool? iosReceivesCredentialSecurely;
///A Boolean value that indicates whether the credentials for the protection space can be sent securely.
///This value is `true` if the credentials for the protection space represented by the receiver can be sent securely, `false` otherwise.
///
///**NOTE**: available only on iOS.
bool? receivesCredentialSecurely;
///Use [isProxy] instead.
@Deprecated('Use isProxy instead')
bool? iosIsProxy;
///Returns a Boolean value that indicates whether the receiver does not descend from `NSObject`.
///
///**NOTE**: available only on iOS.
bool? isProxy;
///Use [proxyType] instead.
@Deprecated('Use proxyType instead')
IOSNSURLProtectionSpaceProxyType? iosProxyType;
///The receiver's proxy type.
///This value is `null` if the receiver does not represent a proxy protection space.
///The supported proxy types are listed in [URLProtectionSpaceProxyType.values].
///
///**NOTE**: available only on iOS.
URLProtectionSpaceProxyType? proxyType;
URLProtectionSpace(
{required this.host,
this.protocol,
this.realm,
this.port,
this.sslCertificate,
this.sslError,
@Deprecated('Use authenticationMethod instead')
this.iosAuthenticationMethod,
this.authenticationMethod,
@Deprecated('Use distinguishedNames instead')
this.iosDistinguishedNames,
this.distinguishedNames,
@Deprecated('Use receivesCredentialSecurely instead')
this.iosReceivesCredentialSecurely,
this.receivesCredentialSecurely,
@Deprecated('Use isProxy instead')
this.iosIsProxy,
this.isProxy,
@Deprecated('Use proxyType instead')
this.iosProxyType,
this.proxyType}) {
authenticationMethod = authenticationMethod ??
URLProtectionSpaceAuthenticationMethod.fromNativeValue(
iosAuthenticationMethod?.toNativeValue());
distinguishedNames = distinguishedNames ?? iosDistinguishedNames;
receivesCredentialSecurely =
receivesCredentialSecurely ?? iosReceivesCredentialSecurely;
isProxy = isProxy ?? iosIsProxy;
proxyType = proxyType ??
URLProtectionSpaceProxyType.fromValue(iosProxyType?.toValue());
}
///Gets a possible [URLProtectionSpace] instance from a [Map] value.
static URLProtectionSpace? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = URLProtectionSpace(
host: map['host'],
);
instance.protocol = map['protocol'];
instance.realm = map['realm'];
instance.port = map['port'];
instance.sslCertificate =
SslCertificate.fromMap(map['sslCertificate']?.cast<String, dynamic>());
instance.sslError =
SslError.fromMap(map['sslError']?.cast<String, dynamic>());
instance.iosAuthenticationMethod =
IOSNSURLProtectionSpaceAuthenticationMethod.fromNativeValue(
map['authenticationMethod']);
instance.authenticationMethod =
URLProtectionSpaceAuthenticationMethod.fromNativeValue(
map['authenticationMethod']);
instance.iosDistinguishedNames =
_distinguishedNamesDeserializer(map['distinguishedNames']);
instance.distinguishedNames =
_distinguishedNamesDeserializer(map['distinguishedNames']);
instance.iosReceivesCredentialSecurely = map['receivesCredentialSecurely'];
instance.receivesCredentialSecurely = map['receivesCredentialSecurely'];
instance.iosIsProxy = map['isProxy'];
instance.isProxy = map['isProxy'];
instance.iosProxyType =
IOSNSURLProtectionSpaceProxyType.fromValue(map['proxyType']);
instance.proxyType =
URLProtectionSpaceProxyType.fromValue(map['proxyType']);
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"host": host,
"protocol": protocol,
"realm": realm,
"port": port,
"sslCertificate": sslCertificate?.toMap(),
"sslError": sslError?.toMap(),
"authenticationMethod": authenticationMethod?.toNativeValue(),
"distinguishedNames": distinguishedNames?.map((e) => e.toMap()).toList(),
"receivesCredentialSecurely": receivesCredentialSecurely,
"isProxy": isProxy,
"proxyType": proxyType?.toValue(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
@override
String toString() {
return 'URLProtectionSpace{host: $host, protocol: $protocol, realm: $realm, port: $port, sslCertificate: $sslCertificate, sslError: $sslError, authenticationMethod: $authenticationMethod, distinguishedNames: $distinguishedNames, receivesCredentialSecurely: $receivesCredentialSecurely, isProxy: $isProxy, proxyType: $proxyType}';
}
}

View File

@ -1,128 +1,63 @@
import 'package:flutter_inappwebview_internal_annotations/flutter_inappwebview_internal_annotations.dart';
import 'url_protection_space.dart'; import 'url_protection_space.dart';
part 'url_protection_space_authentication_method.g.dart';
///Class that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property. ///Class that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property.
class URLProtectionSpaceAuthenticationMethod { @ExchangeableEnum()
class URLProtectionSpaceAuthenticationMethod_ {
// ignore: unused_field
final String _value; final String _value;
const URLProtectionSpaceAuthenticationMethod_._internal(this._value);
const URLProtectionSpaceAuthenticationMethod._internal(this._value);
///Set of all values of [URLProtectionSpaceAuthenticationMethod].
static final Set<URLProtectionSpaceAuthenticationMethod> values = [
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE,
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NEGOTIATE,
URLProtectionSpaceAuthenticationMethod.NSURL_AUTHENTICATION_METHOD_NTLM,
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_SERVER_TRUST,
].toSet();
///Gets a possible [URLProtectionSpaceAuthenticationMethod] instance from a [String] value.
static URLProtectionSpaceAuthenticationMethod? fromValue(String? value) {
if (value != null) {
try {
return URLProtectionSpaceAuthenticationMethod.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///Use client certificate authentication for this protection space. ///Use client certificate authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE = static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE =
const URLProtectionSpaceAuthenticationMethod._internal( const URLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodClientCertificate"); "NSURLAuthenticationMethodClientCertificate");
///Negotiate whether to use Kerberos or NTLM authentication for this protection space. ///Negotiate whether to use Kerberos or NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE = static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE =
const URLProtectionSpaceAuthenticationMethod._internal( const URLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodNegotiate"); "NSURLAuthenticationMethodNegotiate");
///Use NTLM authentication for this protection space. ///Use NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NTLM = static const NSURL_AUTHENTICATION_METHOD_NTLM =
const URLProtectionSpaceAuthenticationMethod._internal( const URLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodNTLM"); "NSURLAuthenticationMethodNTLM");
///Perform server trust authentication (certificate validation) for this protection space. ///Perform server trust authentication (certificate validation) for this protection space.
static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST = static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST =
const URLProtectionSpaceAuthenticationMethod._internal( const URLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodServerTrust"); "NSURLAuthenticationMethodServerTrust");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }
///An iOS-specific Class that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property. ///An iOS-specific Class that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property.
///Use [URLProtectionSpaceAuthenticationMethod] instead. ///Use [URLProtectionSpaceAuthenticationMethod] instead.
@Deprecated("Use URLProtectionSpaceAuthenticationMethod instead") @Deprecated("Use URLProtectionSpaceAuthenticationMethod instead")
class IOSNSURLProtectionSpaceAuthenticationMethod { @ExchangeableEnum()
class IOSNSURLProtectionSpaceAuthenticationMethod_ {
// ignore: unused_field
final String _value; final String _value;
const IOSNSURLProtectionSpaceAuthenticationMethod_._internal(this._value);
const IOSNSURLProtectionSpaceAuthenticationMethod._internal(this._value);
///Set of all values of [IOSNSURLProtectionSpaceAuthenticationMethod].
static final Set<IOSNSURLProtectionSpaceAuthenticationMethod> values = [
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NEGOTIATE,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NTLM,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_SERVER_TRUST,
].toSet();
///Gets a possible [IOSNSURLProtectionSpaceAuthenticationMethod] instance from a [String] value.
static IOSNSURLProtectionSpaceAuthenticationMethod? fromValue(String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceAuthenticationMethod.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets [String] value.
String toValue() => _value;
@override
String toString() => _value;
///Use client certificate authentication for this protection space. ///Use client certificate authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE = static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE =
const IOSNSURLProtectionSpaceAuthenticationMethod._internal( const IOSNSURLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodClientCertificate"); "NSURLAuthenticationMethodClientCertificate");
///Negotiate whether to use Kerberos or NTLM authentication for this protection space. ///Negotiate whether to use Kerberos or NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE = static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE =
const IOSNSURLProtectionSpaceAuthenticationMethod._internal( const IOSNSURLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodNegotiate"); "NSURLAuthenticationMethodNegotiate");
///Use NTLM authentication for this protection space. ///Use NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NTLM = static const NSURL_AUTHENTICATION_METHOD_NTLM =
const IOSNSURLProtectionSpaceAuthenticationMethod._internal( const IOSNSURLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodNTLM"); "NSURLAuthenticationMethodNTLM");
///Perform server trust authentication (certificate validation) for this protection space. ///Perform server trust authentication (certificate validation) for this protection space.
static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST = static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST =
const IOSNSURLProtectionSpaceAuthenticationMethod._internal( const IOSNSURLProtectionSpaceAuthenticationMethod_._internal(
"NSURLAuthenticationMethodServerTrust"); "NSURLAuthenticationMethodServerTrust");
bool operator ==(value) => value == _value;
@override
int get hashCode => _value.hashCode;
} }

View File

@ -0,0 +1,191 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'url_protection_space_authentication_method.dart';
// **************************************************************************
// ExchangeableEnumGenerator
// **************************************************************************
///Class that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property.
class URLProtectionSpaceAuthenticationMethod {
final String _value;
final String _nativeValue;
const URLProtectionSpaceAuthenticationMethod._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory URLProtectionSpaceAuthenticationMethod._internalMultiPlatform(
String value, Function nativeValue) =>
URLProtectionSpaceAuthenticationMethod._internal(value, nativeValue());
///Use client certificate authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE =
URLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodClientCertificate',
'NSURLAuthenticationMethodClientCertificate');
///Negotiate whether to use Kerberos or NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE =
URLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodNegotiate',
'NSURLAuthenticationMethodNegotiate');
///Use NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NTLM =
URLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodNTLM', 'NSURLAuthenticationMethodNTLM');
///Perform server trust authentication (certificate validation) for this protection space.
static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST =
URLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodServerTrust',
'NSURLAuthenticationMethodServerTrust');
///Set of all values of [URLProtectionSpaceAuthenticationMethod].
static final Set<URLProtectionSpaceAuthenticationMethod> values = [
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE,
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NEGOTIATE,
URLProtectionSpaceAuthenticationMethod.NSURL_AUTHENTICATION_METHOD_NTLM,
URLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_SERVER_TRUST,
].toSet();
///Gets a possible [URLProtectionSpaceAuthenticationMethod] instance from [String] value.
static URLProtectionSpaceAuthenticationMethod? fromValue(String? value) {
if (value != null) {
try {
return URLProtectionSpaceAuthenticationMethod.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [URLProtectionSpaceAuthenticationMethod] instance from a native value.
static URLProtectionSpaceAuthenticationMethod? fromNativeValue(
String? value) {
if (value != null) {
try {
return URLProtectionSpaceAuthenticationMethod.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 that represents the constants describing known values of the [URLProtectionSpace.authenticationMethod] property.
///Use [URLProtectionSpaceAuthenticationMethod] instead.
@Deprecated('Use URLProtectionSpaceAuthenticationMethod instead')
class IOSNSURLProtectionSpaceAuthenticationMethod {
final String _value;
final String _nativeValue;
const IOSNSURLProtectionSpaceAuthenticationMethod._internal(
this._value, this._nativeValue);
// ignore: unused_element
factory IOSNSURLProtectionSpaceAuthenticationMethod._internalMultiPlatform(
String value, Function nativeValue) =>
IOSNSURLProtectionSpaceAuthenticationMethod._internal(
value, nativeValue());
///Use client certificate authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE =
IOSNSURLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodClientCertificate',
'NSURLAuthenticationMethodClientCertificate');
///Negotiate whether to use Kerberos or NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NEGOTIATE =
IOSNSURLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodNegotiate',
'NSURLAuthenticationMethodNegotiate');
///Use NTLM authentication for this protection space.
static const NSURL_AUTHENTICATION_METHOD_NTLM =
IOSNSURLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodNTLM', 'NSURLAuthenticationMethodNTLM');
///Perform server trust authentication (certificate validation) for this protection space.
static const NSURL_AUTHENTICATION_METHOD_SERVER_TRUST =
IOSNSURLProtectionSpaceAuthenticationMethod._internal(
'NSURLAuthenticationMethodServerTrust',
'NSURLAuthenticationMethodServerTrust');
///Set of all values of [IOSNSURLProtectionSpaceAuthenticationMethod].
static final Set<IOSNSURLProtectionSpaceAuthenticationMethod> values = [
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_CLIENT_CERTIFICATE,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NEGOTIATE,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_NTLM,
IOSNSURLProtectionSpaceAuthenticationMethod
.NSURL_AUTHENTICATION_METHOD_SERVER_TRUST,
].toSet();
///Gets a possible [IOSNSURLProtectionSpaceAuthenticationMethod] instance from [String] value.
static IOSNSURLProtectionSpaceAuthenticationMethod? fromValue(String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceAuthenticationMethod.values
.firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
}
return null;
}
///Gets a possible [IOSNSURLProtectionSpaceAuthenticationMethod] instance from a native value.
static IOSNSURLProtectionSpaceAuthenticationMethod? fromNativeValue(
String? value) {
if (value != null) {
try {
return IOSNSURLProtectionSpaceAuthenticationMethod.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

@ -13,13 +13,18 @@ dependencies:
flutter_web_plugins: flutter_web_plugins:
sdk: flutter sdk: flutter
js: ^0.6.3 js: ^0.6.3
flutter_inappwebview_internal_annotations:
path: dev_packages/flutter_inappwebview_internal_annotations
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_driver: flutter_driver:
sdk: flutter sdk: flutter
pedantic: ^1.11.1 lints: ^1.0.1
build_runner:
generators:
path: dev_packages/generators
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec # following page: https://www.dartlang.org/tools/pub/pubspec