Commit 993c6f60 authored by Lorenzo Pichilli's avatar Lorenzo Pichilli

v3.4.0

parent f6a6b4a6
...@@ -21,7 +21,6 @@ class ASN1DERDecoder { ...@@ -21,7 +21,6 @@ class ASN1DERDecoder {
asn1obj.identifier = ASN1Identifier(nextValue); asn1obj.identifier = ASN1Identifier(nextValue);
if (asn1obj.identifier.isConstructed()) { if (asn1obj.identifier.isConstructed()) {
var contentData = loadSubContent(iterator: iterator); var contentData = loadSubContent(iterator: iterator);
if (contentData.isEmpty) { if (contentData.isEmpty) {
...@@ -39,9 +38,7 @@ class ASN1DERDecoder { ...@@ -39,9 +38,7 @@ class ASN1DERDecoder {
item.parent = asn1obj; item.parent = asn1obj;
} }
} else { } else {
if (asn1obj.identifier.typeClass() == ASN1IdentifierClass.UNIVERSAL) { if (asn1obj.identifier.typeClass() == ASN1IdentifierClass.UNIVERSAL) {
var contentData = loadSubContent(iterator: iterator); var contentData = loadSubContent(iterator: iterator);
asn1obj.encoded = Uint8List.fromList(contentData); asn1obj.encoded = Uint8List.fromList(contentData);
...@@ -52,75 +49,62 @@ class ASN1DERDecoder { ...@@ -52,75 +49,62 @@ class ASN1DERDecoder {
if (tagNumber == ASN1IdentifierTagNumber.END_OF_CONTENT) { if (tagNumber == ASN1IdentifierTagNumber.END_OF_CONTENT) {
return result; return result;
} } else if (tagNumber == ASN1IdentifierTagNumber.BOOLEAN) {
else if (tagNumber == ASN1IdentifierTagNumber.BOOLEAN) {
var value = contentData.length > 0 ? contentData.first : null; var value = contentData.length > 0 ? contentData.first : null;
if (value != null) { if (value != null) {
asn1obj.value = value > 0 ? true : false; asn1obj.value = value > 0 ? true : false;
} }
} } else if (tagNumber == ASN1IdentifierTagNumber.INTEGER) {
else if (tagNumber == ASN1IdentifierTagNumber.INTEGER) {
while (contentData.length > 0 && contentData.first == 0) { while (contentData.length > 0 && contentData.first == 0) {
contentData.removeAt(0); // remove not significant digit contentData.removeAt(0); // remove not significant digit
} }
asn1obj.value = contentData; asn1obj.value = contentData;
} } else if (tagNumber == ASN1IdentifierTagNumber.NULL) {
else if (tagNumber == ASN1IdentifierTagNumber.NULL) {
asn1obj.value = null; asn1obj.value = null;
} } else if (tagNumber == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) {
else if (tagNumber == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) {
asn1obj.value = decodeOid(contentData: contentData); asn1obj.value = decodeOid(contentData: contentData);
} } else if ([
else if ([
ASN1IdentifierTagNumber.UTF8_STRING, ASN1IdentifierTagNumber.UTF8_STRING,
ASN1IdentifierTagNumber.PRINTABLE_STRING, ASN1IdentifierTagNumber.PRINTABLE_STRING,
ASN1IdentifierTagNumber.NUMERIC_STRING, ASN1IdentifierTagNumber.NUMERIC_STRING,
ASN1IdentifierTagNumber.GENERAL_STRING, ASN1IdentifierTagNumber.GENERAL_STRING,
ASN1IdentifierTagNumber.UNIVERSAL_STRING, ASN1IdentifierTagNumber.UNIVERSAL_STRING,
ASN1IdentifierTagNumber.CHARACTER_STRING, ASN1IdentifierTagNumber.CHARACTER_STRING,
ASN1IdentifierTagNumber.T61_STRING].contains(tagNumber)) { ASN1IdentifierTagNumber.T61_STRING
].contains(tagNumber)) {
asn1obj.value = utf8.decode(contentData, allowMalformed: true); asn1obj.value = utf8.decode(contentData, allowMalformed: true);
} } else if (tagNumber == ASN1IdentifierTagNumber.BMP_STRING) {
else if (tagNumber == ASN1IdentifierTagNumber.BMP_STRING) {
asn1obj.value = String.fromCharCodes(contentData); asn1obj.value = String.fromCharCodes(contentData);
} } else if ([
else if ([
ASN1IdentifierTagNumber.VISIBLE_STRING, ASN1IdentifierTagNumber.VISIBLE_STRING,
ASN1IdentifierTagNumber.IA5_STRING ASN1IdentifierTagNumber.IA5_STRING
].contains(tagNumber)) { ].contains(tagNumber)) {
asn1obj.value = ascii.decode(contentData, allowInvalid: true); asn1obj.value = ascii.decode(contentData, allowInvalid: true);
} } else if (tagNumber == ASN1IdentifierTagNumber.UTC_TIME) {
else if (tagNumber == ASN1IdentifierTagNumber.UTC_TIME) {
asn1obj.value = utcTimeToDate(contentData: contentData); asn1obj.value = utcTimeToDate(contentData: contentData);
} } else if (tagNumber == ASN1IdentifierTagNumber.GENERALIZED_TIME) {
else if (tagNumber == ASN1IdentifierTagNumber.GENERALIZED_TIME) {
asn1obj.value = generalizedTimeToDate(contentData: contentData); asn1obj.value = generalizedTimeToDate(contentData: contentData);
} } else if (tagNumber == ASN1IdentifierTagNumber.BIT_STRING) {
else if (tagNumber == ASN1IdentifierTagNumber.BIT_STRING) {
if (contentData.length > 0) { if (contentData.length > 0) {
contentData.removeAt(0); // unused bits contentData.removeAt(0); // unused bits
} }
asn1obj.value = contentData; asn1obj.value = contentData;
} } else if (tagNumber == ASN1IdentifierTagNumber.OCTET_STRING) {
else if (tagNumber == ASN1IdentifierTagNumber.OCTET_STRING) {
try { try {
var subIterator = contentData.iterator; var subIterator = contentData.iterator;
asn1obj.sub = parse(iterator: subIterator); asn1obj.sub = parse(iterator: subIterator);
} catch (e) { } catch (e) {
var str; var str;
try { try {
str = utf8.decode(contentData); str = utf8.decode(contentData);
} catch(e) {} } catch (e) {}
if (str != null) { if (str != null) {
asn1obj.value = str; asn1obj.value = str;
} else { } else {
asn1obj.value = contentData; asn1obj.value = contentData;
} }
}
} }
else { } else {
// print("unsupported tag: ${asn1obj.identifier.tagNumber()}"); // print("unsupported tag: ${asn1obj.identifier.tagNumber()}");
asn1obj.value = contentData; asn1obj.value = contentData;
} }
...@@ -132,7 +116,7 @@ class ASN1DERDecoder { ...@@ -132,7 +116,7 @@ class ASN1DERDecoder {
var str; var str;
try { try {
str = utf8.decode(contentData); str = utf8.decode(contentData);
} catch(e) {} } catch (e) {}
if (str != null) { if (str != null) {
asn1obj.value = str; asn1obj.value = str;
} else { } else {
...@@ -150,8 +134,8 @@ class ASN1DERDecoder { ...@@ -150,8 +134,8 @@ class ASN1DERDecoder {
if (iterator.moveNext()) { if (iterator.moveNext()) {
var first = iterator.current; var first = iterator.current;
if (first != null) { if (first != null) {
if ((first & 0x80) != 0) {
if ((first & 0x80) != 0) { // long // long
var octetsToRead = first - 0x80; var octetsToRead = first - 0x80;
var data = <int>[]; var data = <int>[];
...@@ -165,11 +149,10 @@ class ASN1DERDecoder { ...@@ -165,11 +149,10 @@ class ASN1DERDecoder {
} }
return toIntValue(data) ?? BigInt.from(0); return toIntValue(data) ?? BigInt.from(0);
} else {
} else { // short // short
return BigInt.from(first); return BigInt.from(first);
} }
} }
} }
return BigInt.from(0); return BigInt.from(0);
...@@ -251,7 +234,7 @@ class ASN1DERDecoder { ...@@ -251,7 +234,7 @@ class ASN1DERDecoder {
String utc; String utc;
try { try {
utc = utf8.decode(contentData); utc = utf8.decode(contentData);
} catch(e) {} } catch (e) {}
if (utc == null) { if (utc == null) {
return null; return null;
} }
...@@ -268,36 +251,30 @@ class ASN1DERDecoder { ...@@ -268,36 +251,30 @@ class ASN1DERDecoder {
int end; int end;
String c; String c;
// not just YYMMDDhhmmZ // not just YYMMDDhhmmZ
if(utc.length > 11) { if (utc.length > 11) {
// get character after minutes // get character after minutes
c = utc[10]; c = utc[10];
end = 10; end = 10;
// see if seconds are present // see if seconds are present
if(c != '+' && c != '-') { if (c != '+' && c != '-') {
// get seconds // get seconds
ss = int.parse(utc.substring(10, 12), radix: 10); ss = int.parse(utc.substring(10, 12), radix: 10);
end += 2; end += 2;
} }
} }
var date = DateTime.utc( var date = DateTime.utc(year, MM, DD, hh, mm, ss, 0);
year,
MM,
DD,
hh,
mm,
ss,
0
);
if(end != null) { if (end != null) {
// get +/- after end of time // get +/- after end of time
c = utc[end]; c = utc[end];
if(c == '+' || c == '-') { if (c == '+' || c == '-') {
// get hours+minutes offset // get hours+minutes offset
var hhoffset = int.parse(utc.substring(end + 1, end + 1 + 2), radix: 10); var hhoffset =
var mmoffset = int.parse(utc.substring(end + 4, end + 4 + 2), radix: 10); int.parse(utc.substring(end + 1, end + 1 + 2), radix: 10);
var mmoffset =
int.parse(utc.substring(end + 4, end + 4 + 2), radix: 10);
// calculate offset in milliseconds // calculate offset in milliseconds
var offset = hhoffset * 60 + mmoffset; var offset = hhoffset * 60 + mmoffset;
...@@ -305,7 +282,7 @@ class ASN1DERDecoder { ...@@ -305,7 +282,7 @@ class ASN1DERDecoder {
var offsetDuration = Duration(milliseconds: offset); var offsetDuration = Duration(milliseconds: offset);
// apply offset // apply offset
if(c == '+') { if (c == '+') {
date.subtract(offsetDuration); date.subtract(offsetDuration);
} else { } else {
date.add(offsetDuration); date.add(offsetDuration);
...@@ -345,7 +322,7 @@ class ASN1DERDecoder { ...@@ -345,7 +322,7 @@ class ASN1DERDecoder {
String gentime; String gentime;
try { try {
gentime = utf8.decode(contentData); gentime = utf8.decode(contentData);
} catch(e) {} } catch (e) {}
if (gentime == null) { if (gentime == null) {
return null; return null;
} }
...@@ -362,23 +339,25 @@ class ASN1DERDecoder { ...@@ -362,23 +339,25 @@ class ASN1DERDecoder {
var offset = 0; var offset = 0;
var isUTC = false; var isUTC = false;
if(gentime[gentime.length - 1] == 'Z') { if (gentime[gentime.length - 1] == 'Z') {
isUTC = true; isUTC = true;
} }
var end = gentime.length - 5; var end = gentime.length - 5;
var c = gentime[end]; var c = gentime[end];
if(c == '+' || c == '-') { if (c == '+' || c == '-') {
// get hours+minutes offset // get hours+minutes offset
var hhoffset = int.parse(gentime.substring(end + 1, end + 1 + 2), radix: 10); var hhoffset =
var mmoffset = int.parse(gentime.substring(end + 4, end + 4 + 2), radix: 10); int.parse(gentime.substring(end + 1, end + 1 + 2), radix: 10);
var mmoffset =
int.parse(gentime.substring(end + 4, end + 4 + 2), radix: 10);
// calculate offset in milliseconds // calculate offset in milliseconds
offset = hhoffset * 60 + mmoffset; offset = hhoffset * 60 + mmoffset;
offset *= 60000; offset *= 60000;
// apply offset // apply offset
if(c == '+') { if (c == '+') {
offset *= -1; offset *= -1;
} }
...@@ -386,26 +365,17 @@ class ASN1DERDecoder { ...@@ -386,26 +365,17 @@ class ASN1DERDecoder {
} }
// check for second fraction // check for second fraction
if(gentime[14] == '.') { if (gentime[14] == '.') {
fff = double.parse(gentime.substring(14)) * 1000; fff = double.parse(gentime.substring(14)) * 1000;
} }
var date = DateTime.utc( var date = DateTime.utc(YYYY, MM, DD, hh, mm, ss, fff.toInt());
YYYY,
MM,
DD,
hh,
mm,
ss,
fff.toInt()
);
if(isUTC) { if (isUTC) {
var offsetDuration = Duration(milliseconds: offset); var offsetDuration = Duration(milliseconds: offset);
date.add(offsetDuration); date.add(offsetDuration);
} }
return date; return date;
} }
} }
...@@ -418,15 +388,11 @@ BigInt toIntValue(List<int> data) { ...@@ -418,15 +388,11 @@ BigInt toIntValue(List<int> data) {
BigInt value = BigInt.from(0); BigInt value = BigInt.from(0);
for (var index = 0; index < data.length; index++) { for (var index = 0; index < data.length; index++) {
var byte = data[index]; var byte = data[index];
value += BigInt.from(byte << 8*(data.length-index-1)); value += BigInt.from(byte << 8 * (data.length - index - 1));
} }
return value; return value;
} }
class ASN1OutOfBufferError extends Error { class ASN1OutOfBufferError extends Error {}
} class ASN1ParseError extends Error {}
class ASN1ParseError extends Error {
}
\ No newline at end of file
...@@ -21,7 +21,8 @@ class ASN1DistinguishedNames { ...@@ -21,7 +21,8 @@ class ASN1DistinguishedNames {
static ASN1DistinguishedNames fromValue(String oid) { static ASN1DistinguishedNames fromValue(String oid) {
if (oid != null) if (oid != null)
return ASN1DistinguishedNames.values.firstWhere((element) => element.oid() == oid, orElse: () => null); return ASN1DistinguishedNames.values
.firstWhere((element) => element.oid() == oid, orElse: () => null);
return null; return null;
} }
...@@ -32,18 +33,30 @@ class ASN1DistinguishedNames { ...@@ -32,18 +33,30 @@ class ASN1DistinguishedNames {
@override @override
String toString() => "($_oid, $_representation)"; String toString() => "($_oid, $_representation)";
static const COMMON_NAME = const ASN1DistinguishedNames._internal("2.5.4.3", "CN"); static const COMMON_NAME =
static const DN_QUALIFIER = const ASN1DistinguishedNames._internal("2.5.4.46", "DNQ"); const ASN1DistinguishedNames._internal("2.5.4.3", "CN");
static const SERIAL_NUMBER = const ASN1DistinguishedNames._internal("2.5.4.5", "SERIALNUMBER"); static const DN_QUALIFIER =
static const GIVEN_NAME = const ASN1DistinguishedNames._internal("2.5.4.42", "GIVENNAME"); const ASN1DistinguishedNames._internal("2.5.4.46", "DNQ");
static const SURNAME = const ASN1DistinguishedNames._internal("2.5.4.4", "SURNAME"); static const SERIAL_NUMBER =
static const ORGANIZATIONAL_UNIT_NAME = const ASN1DistinguishedNames._internal("2.5.4.11", "OU"); const ASN1DistinguishedNames._internal("2.5.4.5", "SERIALNUMBER");
static const ORGANIZATION_NAME = const ASN1DistinguishedNames._internal("2.5.4.10", "O"); static const GIVEN_NAME =
static const STREET_ADDRESS = const ASN1DistinguishedNames._internal("2.5.4.9", "STREET"); const ASN1DistinguishedNames._internal("2.5.4.42", "GIVENNAME");
static const LOCALITY_NAME = const ASN1DistinguishedNames._internal("2.5.4.7", "L"); static const SURNAME =
static const STATE_OR_PROVINCE_NAME = const ASN1DistinguishedNames._internal("2.5.4.8", "ST"); const ASN1DistinguishedNames._internal("2.5.4.4", "SURNAME");
static const COUNTRY_NAME = const ASN1DistinguishedNames._internal("2.5.4.6", "C"); static const ORGANIZATIONAL_UNIT_NAME =
static const EMAIL = const ASN1DistinguishedNames._internal("1.2.840.113549.1.9.1", "E"); const ASN1DistinguishedNames._internal("2.5.4.11", "OU");
static const ORGANIZATION_NAME =
const ASN1DistinguishedNames._internal("2.5.4.10", "O");
static const STREET_ADDRESS =
const ASN1DistinguishedNames._internal("2.5.4.9", "STREET");
static const LOCALITY_NAME =
const ASN1DistinguishedNames._internal("2.5.4.7", "L");
static const STATE_OR_PROVINCE_NAME =
const ASN1DistinguishedNames._internal("2.5.4.8", "ST");
static const COUNTRY_NAME =
const ASN1DistinguishedNames._internal("2.5.4.6", "C");
static const EMAIL =
const ASN1DistinguishedNames._internal("1.2.840.113549.1.9.1", "E");
bool operator ==(value) => value == _oid; bool operator ==(value) => value == _oid;
......
...@@ -12,7 +12,9 @@ class ASN1IdentifierClass { ...@@ -12,7 +12,9 @@ class ASN1IdentifierClass {
static ASN1IdentifierClass fromValue(int value) { static ASN1IdentifierClass fromValue(int value) {
if (value != null) if (value != null)
return ASN1IdentifierClass.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ASN1IdentifierClass.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -81,7 +83,9 @@ class ASN1IdentifierTagNumber { ...@@ -81,7 +83,9 @@ class ASN1IdentifierTagNumber {
static ASN1IdentifierTagNumber fromValue(int value) { static ASN1IdentifierTagNumber fromValue(int value) {
if (value != null) if (value != null)
return ASN1IdentifierTagNumber.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ASN1IdentifierTagNumber.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -93,8 +97,10 @@ class ASN1IdentifierTagNumber { ...@@ -93,8 +97,10 @@ class ASN1IdentifierTagNumber {
static const BIT_STRING = const ASN1IdentifierTagNumber._internal(0x03); static const BIT_STRING = const ASN1IdentifierTagNumber._internal(0x03);
static const OCTET_STRING = const ASN1IdentifierTagNumber._internal(0x04); static const OCTET_STRING = const ASN1IdentifierTagNumber._internal(0x04);
static const NULL = const ASN1IdentifierTagNumber._internal(0x05); static const NULL = const ASN1IdentifierTagNumber._internal(0x05);
static const OBJECT_IDENTIFIER = const ASN1IdentifierTagNumber._internal(0x06); static const OBJECT_IDENTIFIER =
static const OBJECT_DESCRIPTOR = const ASN1IdentifierTagNumber._internal(0x07); const ASN1IdentifierTagNumber._internal(0x06);
static const OBJECT_DESCRIPTOR =
const ASN1IdentifierTagNumber._internal(0x07);
static const EXTERNAL = const ASN1IdentifierTagNumber._internal(0x08); static const EXTERNAL = const ASN1IdentifierTagNumber._internal(0x08);
static const READ = const ASN1IdentifierTagNumber._internal(0x09); static const READ = const ASN1IdentifierTagNumber._internal(0x09);
static const ENUMERATED = const ASN1IdentifierTagNumber._internal(0x0A); static const ENUMERATED = const ASN1IdentifierTagNumber._internal(0x0A);
...@@ -200,11 +206,16 @@ class ASN1Identifier { ...@@ -200,11 +206,16 @@ class ASN1Identifier {
} }
ASN1IdentifierTagNumber tagNumber() { ASN1IdentifierTagNumber tagNumber() {
return ASN1IdentifierTagNumber.fromValue(rawValue & 0x1F) ?? ASN1IdentifierTagNumber.END_OF_CONTENT; return ASN1IdentifierTagNumber.fromValue(rawValue & 0x1F) ??
ASN1IdentifierTagNumber.END_OF_CONTENT;
} }
ASN1IdentifierClass typeClass() { ASN1IdentifierClass typeClass() {
for (var tc in [ASN1IdentifierClass.APPLICATION, ASN1IdentifierClass.CONTEXT_SPECIFIC, ASN1IdentifierClass.PRIVATE]) { for (var tc in [
ASN1IdentifierClass.APPLICATION,
ASN1IdentifierClass.CONTEXT_SPECIFIC,
ASN1IdentifierClass.PRIVATE
]) {
if ((rawValue & tc.toValue()) == tc.toValue()) { if ((rawValue & tc.toValue()) == tc.toValue()) {
return tc; return tc;
} }
......
...@@ -46,12 +46,12 @@ class ASN1Object { ...@@ -46,12 +46,12 @@ class ASN1Object {
ASN1Object findOid({OID oid, String oidValue}) { ASN1Object findOid({OID oid, String oidValue}) {
oidValue = oid != null ? oid.toValue() : oidValue; oidValue = oid != null ? oid.toValue() : oidValue;
for (var child in (sub ?? <ASN1Object>[])) { for (var child in (sub ?? <ASN1Object>[])) {
if (child.identifier?.tagNumber() == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) { if (child.identifier?.tagNumber() ==
ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) {
if (child.value == oidValue) { if (child.value == oidValue) {
return child; return child;
} }
} } else {
else {
var result = child.findOid(oidValue: oidValue); var result = child.findOid(oidValue: oidValue);
if (result != null) { if (result != null) {
return result; return result;
...@@ -69,7 +69,8 @@ class ASN1Object { ...@@ -69,7 +69,8 @@ class ASN1Object {
var output = insets; var output = insets;
output += identifier?.description?.toUpperCase() ?? ""; output += identifier?.description?.toUpperCase() ?? "";
output += (value != null ? ": $value" : ""); output += (value != null ? ": $value" : "");
if (identifier?.typeClass() == ASN1IdentifierClass.UNIVERSAL && identifier?.tagNumber() == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) { if (identifier?.typeClass() == ASN1IdentifierClass.UNIVERSAL &&
identifier?.tagNumber() == ASN1IdentifierTagNumber.OBJECT_IDENTIFIER) {
var descr = OID.fromValue(value?.toString() ?? "")?.name(); var descr = OID.fromValue(value?.toString() ?? "")?.name();
if (descr != null) { if (descr != null) {
output += " ($descr)"; output += " ($descr)";
......
...@@ -16,7 +16,8 @@ class KeyUsage { ...@@ -16,7 +16,8 @@ class KeyUsage {
].toSet(); ].toSet();
static KeyUsage fromIndex(int value) { static KeyUsage fromIndex(int value) {
return KeyUsage.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return KeyUsage.values.firstWhere((element) => element.toValue() == value,
orElse: () => null);
} }
int toValue() => _value; int toValue() => _value;
......
...@@ -103,7 +103,8 @@ class OID { ...@@ -103,7 +103,8 @@ class OID {
].toSet(); ].toSet();
static OID fromValue(String value) { static OID fromValue(String value) {
return OID.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return OID.values.firstWhere((element) => element.toValue() == value,
orElse: () => null);
} }
String toValue() => _value; String toValue() => _value;
...@@ -122,29 +123,40 @@ class OID { ...@@ -122,29 +123,40 @@ class OID {
static const ecdsaWithSHA256 = const OID._internal("1.2.840.10045.4.3.2"); static const ecdsaWithSHA256 = const OID._internal("1.2.840.10045.4.3.2");
static const ecdsaWithSHA512 = const OID._internal("1.2.840.10045.4.3.4"); static const ecdsaWithSHA512 = const OID._internal("1.2.840.10045.4.3.4");
static const rsaEncryption = const OID._internal("1.2.840.113549.1.1.1"); static const rsaEncryption = const OID._internal("1.2.840.113549.1.1.1");
static const md2WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.2"); static const md2WithRSAEncryption =
static const md4WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.3"); const OID._internal("1.2.840.113549.1.1.2");
static const md5WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.4"); static const md4WithRSAEncryption =
static const sha1WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.5"); const OID._internal("1.2.840.113549.1.1.3");
static const md5WithRSAEncryption =
const OID._internal("1.2.840.113549.1.1.4");
static const sha1WithRSAEncryption =
const OID._internal("1.2.840.113549.1.1.5");
static const RSAES_OAEP = const OID._internal("1.2.840.113549.1.1.7"); static const RSAES_OAEP = const OID._internal("1.2.840.113549.1.1.7");
static const mgf1 = const OID._internal(".2.840.113549.1.1.8"); static const mgf1 = const OID._internal(".2.840.113549.1.1.8");
static const pSpecified = const OID._internal(".2.840.113549.1.1.9"); static const pSpecified = const OID._internal(".2.840.113549.1.1.9");
static const RSASSA_PSS = const OID._internal(".2.840.113549.1.1.10"); static const RSASSA_PSS = const OID._internal(".2.840.113549.1.1.10");
static const sha256WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.11"); static const sha256WithRSAEncryption =
static const sha384WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.12"); const OID._internal("1.2.840.113549.1.1.11");
static const sha512WithRSAEncryption = const OID._internal("1.2.840.113549.1.1.13"); static const sha384WithRSAEncryption =
const OID._internal("1.2.840.113549.1.1.12");
static const sha512WithRSAEncryption =
const OID._internal("1.2.840.113549.1.1.13");
static const pkcs7data = const OID._internal("1.2.840.113549.1.7.1"); static const pkcs7data = const OID._internal("1.2.840.113549.1.7.1");
static const pkcs7signedData = const OID._internal("1.2.840.113549.1.7.2"); static const pkcs7signedData = const OID._internal("1.2.840.113549.1.7.2");
static const pkcs7envelopedData = const OID._internal("1.2.840.113549.1.7.3"); static const pkcs7envelopedData = const OID._internal("1.2.840.113549.1.7.3");
static const emailAddress = const OID._internal("1.2.840.113549.1.9.1"); static const emailAddress = const OID._internal("1.2.840.113549.1.9.1");
static const signingCertificateV2 = const OID._internal("1.2.840.113549.1.9.16.2.47"); static const signingCertificateV2 =
const OID._internal("1.2.840.113549.1.9.16.2.47");
static const contentType = const OID._internal("1.2.840.113549.1.9.3"); static const contentType = const OID._internal("1.2.840.113549.1.9.3");
static const messageDigest = const OID._internal("1.2.840.113549.1.9.4"); static const messageDigest = const OID._internal("1.2.840.113549.1.9.4");
static const signingTime = const OID._internal("1.2.840.113549.1.9.5"); static const signingTime = const OID._internal("1.2.840.113549.1.9.5");
static const dsaWithSha1 = const OID._internal("1.2.840.10040.4.3"); static const dsaWithSha1 = const OID._internal("1.2.840.10040.4.3");
static const certificateExtension = const OID._internal("1.3.6.1.4.1.11129.2.4.2"); static const certificateExtension =
static const jurisdictionOfIncorporationSP = const OID._internal("1.3.6.1.4.1.311.60.2.1.2"); const OID._internal("1.3.6.1.4.1.11129.2.4.2");
static const jurisdictionOfIncorporationC = const OID._internal("1.3.6.1.4.1.311.60.2.1.3"); static const jurisdictionOfIncorporationSP =
const OID._internal("1.3.6.1.4.1.311.60.2.1.2");
static const jurisdictionOfIncorporationC =
const OID._internal("1.3.6.1.4.1.311.60.2.1.3");
static const authorityInfoAccess = const OID._internal("1.3.6.1.5.5.7.1.1"); static const authorityInfoAccess = const OID._internal("1.3.6.1.5.5.7.1.1");
static const qcStatements = const OID._internal("1.3.6.1.5.5.7.1.3"); static const qcStatements = const OID._internal("1.3.6.1.5.5.7.1.3");
static const cps = const OID._internal("1.3.6.1.5.5.7.2.1"); static const cps = const OID._internal("1.3.6.1.5.5.7.2.1");
...@@ -160,7 +172,8 @@ class OID { ...@@ -160,7 +172,8 @@ class OID {
static const sha384 = const OID._internal("2.16.840.1.101.3.4.2.2"); static const sha384 = const OID._internal("2.16.840.1.101.3.4.2.2");
static const sha512 = const OID._internal("2.16.840.1.101.3.4.2.3"); static const sha512 = const OID._internal("2.16.840.1.101.3.4.2.3");
static const md5 = const OID._internal("1.2.840.113549.2.5"); static const md5 = const OID._internal("1.2.840.113549.2.5");
static const VeriSignEVpolicy = const OID._internal("2.16.840.1.113733.1.7.23.6"); static const VeriSignEVpolicy =
const OID._internal("2.16.840.1.113733.1.7.23.6");
static const extendedValidation = const OID._internal("2.23.140.1.1"); static const extendedValidation = const OID._internal("2.23.140.1.1");
static const organizationValidated = const OID._internal("2.23.140.1.2.2"); static const organizationValidated = const OID._internal("2.23.140.1.2.2");
static const subjectKeyIdentifier = const OID._internal("2.5.29.14"); static const subjectKeyIdentifier = const OID._internal("2.5.29.14");
......
...@@ -322,7 +322,11 @@ class X509Certificate { ...@@ -322,7 +322,11 @@ class X509Certificate {
///Gets the certificate constraints path length from the ///Gets the certificate constraints path length from the
///critical BasicConstraints extension, (OID = 2.5.29.19). ///critical BasicConstraints extension, (OID = 2.5.29.19).
int get basicConstraints { int get basicConstraints {
var sub = extensionObject(oid: OID.basicConstraints)?.block?.lastSub()?.lastSub()?.lastSub(); var sub = extensionObject(oid: OID.basicConstraints)
?.block
?.lastSub()
?.lastSub()
?.lastSub();
if (sub != null) { if (sub != null) {
if (sub.value is List<int>) { if (sub.value is List<int>) {
return (sub.value as List<int>).length; return (sub.value as List<int>).length;
...@@ -333,31 +337,60 @@ class X509Certificate { ...@@ -333,31 +337,60 @@ class X509Certificate {
///Gets the raw bits from the Subject Key Identifier (SKID) extension, (OID = 2.5.29.14). ///Gets the raw bits from the Subject Key Identifier (SKID) extension, (OID = 2.5.29.14).
List<int> get subjectKeyIdentifier => List<int> get subjectKeyIdentifier =>
extensionObject(oid: OID.subjectKeyIdentifier)?.block?.lastSub()?.lastSub()?.value ?? <int>[]; extensionObject(oid: OID.subjectKeyIdentifier)
?.block
?.lastSub()
?.lastSub()
?.value ??
<int>[];
///Gets the raw bits from the Authority Key Identifier extension, (OID = 2.5.29.35). ///Gets the raw bits from the Authority Key Identifier extension, (OID = 2.5.29.35).
List<int> get authorityKeyIdentifier => List<int> get authorityKeyIdentifier =>
extensionObject(oid: OID.authorityKeyIdentifier)?.block?.lastSub()?.lastSub()?.firstSub()?.value ?? <int>[]; extensionObject(oid: OID.authorityKeyIdentifier)
?.block
?.lastSub()
?.lastSub()
?.firstSub()
?.value ??
<int>[];
///Gets the list of certificate policies from the CertificatePolicies extension, (OID = 2.5.29.32). ///Gets the list of certificate policies from the CertificatePolicies extension, (OID = 2.5.29.32).
List<String> get certificatePolicies => List<String> get certificatePolicies =>
extensionObject(oid: OID.certificatePolicies)?.block?.lastSub()?.firstSub()?.sub?.map((e) => e.firstSub()?.value as String)?.toList() ?? <String>[]; extensionObject(oid: OID.certificatePolicies)
?.block
?.lastSub()
?.firstSub()
?.sub
?.map((e) => e.firstSub()?.value as String)
?.toList() ??
<String>[];
///Gets the list of CRL distribution points from the CRLDistributionPoints extension, (OID = 2.5.29.31). ///Gets the list of CRL distribution points from the CRLDistributionPoints extension, (OID = 2.5.29.31).
List<String> get cRLDistributionPoints => List<String> get cRLDistributionPoints =>
extensionObject(oid: OID.cRLDistributionPoints)?.block?.lastSub()?.firstSub()?.sub?.map((e) => e.firstSub()?.firstSub()?.firstSub()?.value as String)?.toList() ?? <String>[]; extensionObject(oid: OID.cRLDistributionPoints)
?.block
?.lastSub()
?.firstSub()
?.sub
?.map((e) => e.firstSub()?.firstSub()?.firstSub()?.value as String)
?.toList() ??
<String>[];
///Gets the map of the format (as a key) and location (as a value) of additional information ///Gets the map of the format (as a key) and location (as a value) of additional information
///about the CA who issued the certificate in which this extension appears ///about the CA who issued the certificate in which this extension appears
///from the AuthorityInfoAccess extension, (OID = 1.3.6.1.5.5.5.7.1.1). ///from the AuthorityInfoAccess extension, (OID = 1.3.6.1.5.5.5.7.1.1).
Map<String, String> get authorityInfoAccess { Map<String, String> get authorityInfoAccess {
var result = <String, String>{}; var result = <String, String>{};
var sub = extensionObject(oid: OID.authorityInfoAccess)?.block?.lastSub()?.firstSub()?.sub; var sub = extensionObject(oid: OID.authorityInfoAccess)
?.block
?.lastSub()
?.firstSub()
?.sub;
if (sub != null) { if (sub != null) {
sub.forEach((element) { sub.forEach((element) {
if (element.subCount() > 1) { if (element.subCount() > 1) {
result.putIfAbsent(element.subAtIndex(0).value, result.putIfAbsent(
() => element.subAtIndex(1).value); element.subAtIndex(0).value, () => element.subAtIndex(1).value);
} }
}); });
} }
...@@ -413,8 +446,6 @@ class X509Certificate { ...@@ -413,8 +446,6 @@ class X509Certificate {
result += quote; result += quote;
} }
} }
} }
} }
return result; return result;
......
...@@ -25,11 +25,13 @@ class X509PublicKey { ...@@ -25,11 +25,13 @@ class X509PublicKey {
} else if (oid == OID.rsaEncryption) { } else if (oid == OID.rsaEncryption) {
List<ASN1Object> publicKeyAsn1Objects; List<ASN1Object> publicKeyAsn1Objects;
try { try {
publicKeyAsn1Objects = ASN1DERDecoder.decode(data: keyData.toList(growable: true)); publicKeyAsn1Objects =
} catch(e) {} ASN1DERDecoder.decode(data: keyData.toList(growable: true));
} catch (e) {}
if (publicKeyAsn1Objects != null && publicKeyAsn1Objects.length > 0) { if (publicKeyAsn1Objects != null && publicKeyAsn1Objects.length > 0) {
var publicKeyModulus = publicKeyAsn1Objects.first?.subAtIndex(0)?.value; var publicKeyModulus =
publicKeyAsn1Objects.first?.subAtIndex(0)?.value;
if (publicKeyModulus != null) { if (publicKeyModulus != null) {
return Uint8List.fromList(publicKeyModulus); return Uint8List.fromList(publicKeyModulus);
} }
......
...@@ -84,7 +84,8 @@ class CookieManager { ...@@ -84,7 +84,8 @@ class CookieManager {
expiresDate: cookieListMap[i]["expiresDate"], expiresDate: cookieListMap[i]["expiresDate"],
isSessionOnly: cookieListMap[i]["isSessionOnly"], isSessionOnly: cookieListMap[i]["isSessionOnly"],
domain: cookieListMap[i]["domain"], domain: cookieListMap[i]["domain"],
sameSite: HTTPCookieSameSitePolicy.fromValue(cookieListMap[i]["sameSite"]), sameSite:
HTTPCookieSameSitePolicy.fromValue(cookieListMap[i]["sameSite"]),
isSecure: cookieListMap[i]["isSecure"], isSecure: cookieListMap[i]["isSecure"],
isHttpOnly: cookieListMap[i]["isHttpOnly"], isHttpOnly: cookieListMap[i]["isHttpOnly"],
path: cookieListMap[i]["path"])); path: cookieListMap[i]["path"]));
...@@ -111,7 +112,8 @@ class CookieManager { ...@@ -111,7 +112,8 @@ class CookieManager {
expiresDate: cookies[i]["expiresDate"], expiresDate: cookies[i]["expiresDate"],
isSessionOnly: cookies[i]["isSessionOnly"], isSessionOnly: cookies[i]["isSessionOnly"],
domain: cookies[i]["domain"], domain: cookies[i]["domain"],
sameSite: HTTPCookieSameSitePolicy.fromValue(cookies[i]["sameSite"]), sameSite:
HTTPCookieSameSitePolicy.fromValue(cookies[i]["sameSite"]),
isSecure: cookies[i]["isSecure"], isSecure: cookies[i]["isSecure"],
isHttpOnly: cookies[i]["isHttpOnly"], isHttpOnly: cookies[i]["isHttpOnly"],
path: cookies[i]["path"]); path: cookies[i]["path"]);
......
...@@ -31,7 +31,8 @@ class HttpAuthCredentialDatabase { ...@@ -31,7 +31,8 @@ class HttpAuthCredentialDatabase {
///Gets a map list of all HTTP auth credentials saved. ///Gets a map list of all HTTP auth credentials saved.
///Each map contains the key `protectionSpace` of type [ProtectionSpace] ///Each map contains the key `protectionSpace` of type [ProtectionSpace]
///and the key `credentials` of type `List<HttpAuthCredential>` that contains all the HTTP auth credentials saved for that `protectionSpace`. ///and the key `credentials` of type `List<HttpAuthCredential>` that contains all the HTTP auth credentials saved for that `protectionSpace`.
Future<List<ProtectionSpaceHttpAuthCredentials>> getAllAuthCredentials() async { Future<List<ProtectionSpaceHttpAuthCredentials>>
getAllAuthCredentials() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
List<dynamic> allCredentials = List<dynamic> allCredentials =
await _channel.invokeMethod('getAllAuthCredentials', args); await _channel.invokeMethod('getAllAuthCredentials', args);
...@@ -41,8 +42,7 @@ class HttpAuthCredentialDatabase { ...@@ -41,8 +42,7 @@ class HttpAuthCredentialDatabase {
for (Map<dynamic, dynamic> map in allCredentials) { for (Map<dynamic, dynamic> map in allCredentials) {
Map<dynamic, dynamic> protectionSpace = map["protectionSpace"]; Map<dynamic, dynamic> protectionSpace = map["protectionSpace"];
List<dynamic> credentials = map["credentials"]; List<dynamic> credentials = map["credentials"];
result.add( result.add(ProtectionSpaceHttpAuthCredentials(
ProtectionSpaceHttpAuthCredentials(
protectionSpace: ProtectionSpace( protectionSpace: ProtectionSpace(
host: protectionSpace["host"], host: protectionSpace["host"],
protocol: protectionSpace["protocol"], protocol: protectionSpace["protocol"],
...@@ -52,9 +52,7 @@ class HttpAuthCredentialDatabase { ...@@ -52,9 +52,7 @@ class HttpAuthCredentialDatabase {
.map((credential) => HttpAuthCredential( .map((credential) => HttpAuthCredential(
username: credential["username"], username: credential["username"],
password: credential["password"])) password: credential["password"]))
.toList() .toList()));
)
);
} }
return result; return result;
} }
......
...@@ -69,7 +69,8 @@ class InAppWebViewController { ...@@ -69,7 +69,8 @@ class InAppWebViewController {
this._webview = webview; this._webview = webview;
this.android = AndroidInAppWebViewController(this); this.android = AndroidInAppWebViewController(this);
this.ios = IOSInAppWebViewController(this); this.ios = IOSInAppWebViewController(this);
this.webStorage = WebStorage(localStorage: LocalStorage(this), sessionStorage: SessionStorage(this)); this.webStorage = WebStorage(
localStorage: LocalStorage(this), sessionStorage: SessionStorage(this));
} }
InAppWebViewController.fromInAppBrowser( InAppWebViewController.fromInAppBrowser(
...@@ -369,29 +370,45 @@ class InAppWebViewController { ...@@ -369,29 +370,45 @@ class InAppWebViewController {
int androidError = call.arguments["androidError"]; int androidError = call.arguments["androidError"];
int iosError = call.arguments["iosError"]; int iosError = call.arguments["iosError"];
String message = call.arguments["message"]; String message = call.arguments["message"];
Map<String, dynamic> sslCertificateMap = call.arguments["sslCertificate"]?.cast<String, dynamic>(); Map<String, dynamic> sslCertificateMap =
call.arguments["sslCertificate"]?.cast<String, dynamic>();
SslCertificate sslCertificate; SslCertificate sslCertificate;
if (sslCertificateMap != null) { if (sslCertificateMap != null) {
if (Platform.isIOS) { if (Platform.isIOS) {
try { try {
X509Certificate x509certificate = X509Certificate.fromData(data: sslCertificateMap["x509Certificate"]); X509Certificate x509certificate = X509Certificate.fromData(
data: sslCertificateMap["x509Certificate"]);
sslCertificate = SslCertificate( sslCertificate = SslCertificate(
issuedBy: SslCertificateDName( issuedBy: SslCertificateDName(
CName: x509certificate.issuer(dn: ASN1DistinguishedNames.COMMON_NAME) ?? "", CName: x509certificate.issuer(
dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509certificate.issuerDistinguishedName ?? "", DName: x509certificate.issuerDistinguishedName ?? "",
OName: x509certificate.issuer(dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ?? "", OName: x509certificate.issuer(
UName: x509certificate.issuer(dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ?? ""), dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509certificate.issuer(
dn: ASN1DistinguishedNames
.ORGANIZATIONAL_UNIT_NAME) ??
""),
issuedTo: SslCertificateDName( issuedTo: SslCertificateDName(
CName: x509certificate.subject(dn: ASN1DistinguishedNames.COMMON_NAME) ?? "", CName: x509certificate.subject(
dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509certificate.subjectDistinguishedName ?? "", DName: x509certificate.subjectDistinguishedName ?? "",
OName: x509certificate.subject(dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ?? "", OName: x509certificate.subject(
UName: x509certificate.subject(dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ?? ""), dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509certificate.subject(
dn: ASN1DistinguishedNames
.ORGANIZATIONAL_UNIT_NAME) ??
""),
validNotAfterDate: x509certificate.notAfter, validNotAfterDate: x509certificate.notAfter,
validNotBeforeDate: x509certificate.notBefore, validNotBeforeDate: x509certificate.notBefore,
x509Certificate: x509certificate, x509Certificate: x509certificate,
); );
} catch(e, stacktrace) { } catch (e, stacktrace) {
print(e); print(e);
print(stacktrace); print(stacktrace);
return null; return null;
...@@ -401,8 +418,11 @@ class InAppWebViewController { ...@@ -401,8 +418,11 @@ class InAppWebViewController {
} }
} }
AndroidSslError androidSslError = androidError != null ? AndroidSslError.fromValue(androidError) : null; AndroidSslError androidSslError = androidError != null
IOSSslError iosSslError = iosError != null ? IOSSslError.fromValue(iosError) : null; ? AndroidSslError.fromValue(androidError)
: null;
IOSSslError iosSslError =
iosError != null ? IOSSslError.fromValue(iosError) : null;
var protectionSpace = ProtectionSpace( var protectionSpace = ProtectionSpace(
host: host, protocol: protocol, realm: realm, port: port); host: host, protocol: protocol, realm: realm, port: port);
...@@ -884,8 +904,7 @@ class InAppWebViewController { ...@@ -884,8 +904,7 @@ class InAppWebViewController {
InAppWebViewGroupOptions options = await getOptions(); InAppWebViewGroupOptions options = await getOptions();
if (options != null && options.crossPlatform.javaScriptEnabled == true) { if (options != null && options.crossPlatform.javaScriptEnabled == true) {
List<Map<dynamic, dynamic>> links = (await evaluateJavascript( List<Map<dynamic, dynamic>> links = (await evaluateJavascript(source: """
source: """
(function() { (function() {
var linkNodes = document.head.getElementsByTagName("link"); var linkNodes = document.head.getElementsByTagName("link");
var links = []; var links = [];
...@@ -1466,7 +1485,8 @@ class InAppWebViewController { ...@@ -1466,7 +1485,8 @@ class InAppWebViewController {
/// ///
///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollTo(int,%20int) ///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollTo(int,%20int)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset ///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset
Future<void> scrollTo({@required int x, @required int y, bool animated = false}) async { Future<void> scrollTo(
{@required int x, @required int y, bool animated = false}) async {
assert(x != null && y != null); assert(x != null && y != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('x', () => x); args.putIfAbsent('x', () => x);
...@@ -1485,7 +1505,8 @@ class InAppWebViewController { ...@@ -1485,7 +1505,8 @@ class InAppWebViewController {
/// ///
///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollBy(int,%20int) ///**Official Android API**: https://developer.android.com/reference/android/view/View#scrollBy(int,%20int)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset ///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619400-setcontentoffset
Future<void> scrollBy({@required int x, @required int y, bool animated = false}) async { Future<void> scrollBy(
{@required int x, @required int y, bool animated = false}) async {
assert(x != null && y != null); assert(x != null && y != null);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('x', () => x); args.putIfAbsent('x', () => x);
...@@ -1544,7 +1565,8 @@ class InAppWebViewController { ...@@ -1544,7 +1565,8 @@ class InAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#zoomBy(float) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#zoomBy(float)
///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale ///**Official iOS API**: https://developer.apple.com/documentation/uikit/uiscrollview/1619412-setzoomscale
Future<void> zoomBy(double zoomFactor) async { Future<void> zoomBy(double zoomFactor) async {
assert(!Platform.isAndroid || (Platform.isAndroid && zoomFactor > 0.01 && zoomFactor <= 100.0)); assert(!Platform.isAndroid ||
(Platform.isAndroid && zoomFactor > 0.01 && zoomFactor <= 100.0));
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('zoomFactor', () => zoomFactor); args.putIfAbsent('zoomFactor', () => zoomFactor);
...@@ -1611,12 +1633,15 @@ class InAppWebViewController { ...@@ -1611,12 +1633,15 @@ class InAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#requestFocusNodeHref(android.os.Message) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#requestFocusNodeHref(android.os.Message)
Future<RequestFocusNodeHrefResult> requestFocusNodeHref() async { Future<RequestFocusNodeHrefResult> requestFocusNodeHref() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<dynamic, dynamic> result = await _channel.invokeMethod('requestFocusNodeHref', args); Map<dynamic, dynamic> result =
return result != null ? RequestFocusNodeHrefResult( await _channel.invokeMethod('requestFocusNodeHref', args);
return result != null
? RequestFocusNodeHrefResult(
url: result['url'], url: result['url'],
title: result['title'], title: result['title'],
src: result['src'], src: result['src'],
) : null; )
: null;
} }
///Requests the URL of the image last touched by the user. ///Requests the URL of the image last touched by the user.
...@@ -1626,10 +1651,13 @@ class InAppWebViewController { ...@@ -1626,10 +1651,13 @@ class InAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#requestImageRef(android.os.Message) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#requestImageRef(android.os.Message)
Future<RequestImageRefResult> requestImageRef() async { Future<RequestImageRefResult> requestImageRef() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<dynamic, dynamic> result = await _channel.invokeMethod('requestImageRef', args); Map<dynamic, dynamic> result =
return result != null ? RequestImageRefResult( await _channel.invokeMethod('requestImageRef', args);
return result != null
? RequestImageRefResult(
url: result['url'], url: result['url'],
) : null; )
: null;
} }
///Returns the list of `<meta>` tags of the current WebView. ///Returns the list of `<meta>` tags of the current WebView.
...@@ -1638,7 +1666,8 @@ class InAppWebViewController { ...@@ -1638,7 +1666,8 @@ class InAppWebViewController {
Future<List<MetaTag>> getMetaTags() async { Future<List<MetaTag>> getMetaTags() async {
List<MetaTag> metaTags = []; List<MetaTag> metaTags = [];
List<Map<dynamic, dynamic>> metaTagList = (await evaluateJavascript(source: """ List<Map<dynamic, dynamic>> metaTagList =
(await evaluateJavascript(source: """
(function() { (function() {
var metaTags = []; var metaTags = [];
var metaTagNodes = document.head.getElementsByTagName('meta'); var metaTagNodes = document.head.getElementsByTagName('meta');
...@@ -1682,14 +1711,12 @@ class InAppWebViewController { ...@@ -1682,14 +1711,12 @@ class InAppWebViewController {
var attrs = <MetaTagAttribute>[]; var attrs = <MetaTagAttribute>[];
for (var metaTagAttr in metaTag["attrs"]) { for (var metaTagAttr in metaTag["attrs"]) {
attrs.add( attrs.add(MetaTagAttribute(
MetaTagAttribute(name: metaTagAttr["name"], value: metaTagAttr["value"]) name: metaTagAttr["name"], value: metaTagAttr["value"]));
);
} }
metaTags.add( metaTags.add(MetaTag(
MetaTag(name: metaTag["name"], content: metaTag["content"], attrs: attrs) name: metaTag["name"], content: metaTag["content"], attrs: attrs));
);
} }
return metaTags; return metaTags;
...@@ -1743,28 +1770,43 @@ class InAppWebViewController { ...@@ -1743,28 +1770,43 @@ class InAppWebViewController {
Future<SslCertificate> getCertificate() async { Future<SslCertificate> getCertificate() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic> sslCertificateMap = (await _channel.invokeMethod('getCertificate', args))?.cast<String, dynamic>(); Map<String, dynamic> sslCertificateMap =
(await _channel.invokeMethod('getCertificate', args))
?.cast<String, dynamic>();
if (sslCertificateMap != null) { if (sslCertificateMap != null) {
if (Platform.isIOS) { if (Platform.isIOS) {
try { try {
X509Certificate x509certificate = X509Certificate.fromData(data: sslCertificateMap["x509Certificate"]); X509Certificate x509certificate = X509Certificate.fromData(
data: sslCertificateMap["x509Certificate"]);
return SslCertificate( return SslCertificate(
issuedBy: SslCertificateDName( issuedBy: SslCertificateDName(
CName: x509certificate.issuer(dn: ASN1DistinguishedNames.COMMON_NAME) ?? "", CName: x509certificate.issuer(
dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509certificate.issuerDistinguishedName ?? "", DName: x509certificate.issuerDistinguishedName ?? "",
OName: x509certificate.issuer(dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ?? "", OName: x509certificate.issuer(
UName: x509certificate.issuer(dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ?? ""), dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509certificate.issuer(
dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ??
""),
issuedTo: SslCertificateDName( issuedTo: SslCertificateDName(
CName: x509certificate.subject(dn: ASN1DistinguishedNames.COMMON_NAME) ?? "", CName: x509certificate.subject(
dn: ASN1DistinguishedNames.COMMON_NAME) ??
"",
DName: x509certificate.subjectDistinguishedName ?? "", DName: x509certificate.subjectDistinguishedName ?? "",
OName: x509certificate.subject(dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ?? "", OName: x509certificate.subject(
UName: x509certificate.subject(dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ?? ""), dn: ASN1DistinguishedNames.ORGANIZATION_NAME) ??
"",
UName: x509certificate.subject(
dn: ASN1DistinguishedNames.ORGANIZATIONAL_UNIT_NAME) ??
""),
validNotAfterDate: x509certificate.notAfter, validNotAfterDate: x509certificate.notAfter,
validNotBeforeDate: x509certificate.notBefore, validNotBeforeDate: x509certificate.notBefore,
x509Certificate: x509certificate, x509Certificate: x509certificate,
); );
} catch(e, stacktrace) { } catch (e, stacktrace) {
print(e); print(e);
print(stacktrace); print(stacktrace);
return null; return null;
......
...@@ -46,7 +46,9 @@ class ConsoleMessageLevel { ...@@ -46,7 +46,9 @@ class ConsoleMessageLevel {
static ConsoleMessageLevel fromValue(int value) { static ConsoleMessageLevel fromValue(int value) {
if (value != null) if (value != null)
return ConsoleMessageLevel.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ConsoleMessageLevel.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -134,7 +136,8 @@ class InAppWebViewInitialData { ...@@ -134,7 +136,8 @@ class InAppWebViewInitialData {
///The URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. This parameter is used only on Android. ///The URL to use as the history entry. The default value is `about:blank`. If non-null, this must be a valid URL. This parameter is used only on Android.
String historyUrl; String historyUrl;
InAppWebViewInitialData({@required this.data, InAppWebViewInitialData(
{@required this.data,
this.mimeType = "text/html", this.mimeType = "text/html",
this.encoding = "utf8", this.encoding = "utf8",
this.baseUrl = "about:blank", this.baseUrl = "about:blank",
...@@ -196,7 +199,8 @@ class WebResourceRequest { ...@@ -196,7 +199,8 @@ class WebResourceRequest {
///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`. ///**NOTE**: Available on Android 21+. For Android < 21 it will be always `false`.
bool isRedirect; bool isRedirect;
WebResourceRequest({@required this.url, WebResourceRequest(
{@required this.url,
this.headers, this.headers,
this.method, this.method,
this.hasGesture, this.hasGesture,
...@@ -255,7 +259,8 @@ class WebResourceResponse { ...@@ -255,7 +259,8 @@ class WebResourceResponse {
///**NOTE**: Available on Android 21+. For Android < 21 it won't be used. ///**NOTE**: Available on Android 21+. For Android < 21 it won't be used.
String reasonPhrase; String reasonPhrase;
WebResourceResponse({this.contentType = "", WebResourceResponse(
{this.contentType = "",
this.contentEncoding = "utf-8", this.contentEncoding = "utf-8",
this.data, this.data,
this.headers, this.headers,
...@@ -294,7 +299,8 @@ class CustomSchemeResponse { ...@@ -294,7 +299,8 @@ class CustomSchemeResponse {
///Content-Enconding of the data, such as `utf-8`. ///Content-Enconding of the data, such as `utf-8`.
String contentEnconding; String contentEnconding;
CustomSchemeResponse({@required this.data, CustomSchemeResponse(
{@required this.data,
@required this.contentType, @required this.contentType,
this.contentEnconding = 'utf-8'}); this.contentEnconding = 'utf-8'});
...@@ -463,7 +469,8 @@ class JsAlertResponse { ...@@ -463,7 +469,8 @@ class JsAlertResponse {
///Action used to confirm that the user hit confirm button. ///Action used to confirm that the user hit confirm button.
JsAlertResponseAction action; JsAlertResponseAction action;
JsAlertResponse({this.message = "", JsAlertResponse(
{this.message = "",
this.handledByClient = false, this.handledByClient = false,
this.confirmButtonTitle = "", this.confirmButtonTitle = "",
this.action = JsAlertResponseAction.CONFIRM}); this.action = JsAlertResponseAction.CONFIRM});
...@@ -521,7 +528,8 @@ class JsConfirmResponse { ...@@ -521,7 +528,8 @@ class JsConfirmResponse {
///Action used to confirm that the user hit confirm or cancel button. ///Action used to confirm that the user hit confirm or cancel button.
JsConfirmResponseAction action; JsConfirmResponseAction action;
JsConfirmResponse({this.message = "", JsConfirmResponse(
{this.message = "",
this.handledByClient = false, this.handledByClient = false,
this.confirmButtonTitle = "", this.confirmButtonTitle = "",
this.cancelButtonTitle = "", this.cancelButtonTitle = "",
...@@ -587,7 +595,8 @@ class JsPromptResponse { ...@@ -587,7 +595,8 @@ class JsPromptResponse {
///Action used to confirm that the user hit confirm or cancel button. ///Action used to confirm that the user hit confirm or cancel button.
JsPromptResponseAction action; JsPromptResponseAction action;
JsPromptResponse({this.message = "", JsPromptResponse(
{this.message = "",
this.defaultValue = "", this.defaultValue = "",
this.handledByClient = false, this.handledByClient = false,
this.confirmButtonTitle = "", this.confirmButtonTitle = "",
...@@ -633,7 +642,9 @@ class SafeBrowsingThreat { ...@@ -633,7 +642,9 @@ class SafeBrowsingThreat {
static SafeBrowsingThreat fromValue(int value) { static SafeBrowsingThreat fromValue(int value) {
if (value != null) if (value != null)
return SafeBrowsingThreat.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return SafeBrowsingThreat.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -705,7 +716,8 @@ class SafeBrowsingResponse { ...@@ -705,7 +716,8 @@ class SafeBrowsingResponse {
///Indicate the [SafeBrowsingResponseAction] to take when hitting a malicious URL. ///Indicate the [SafeBrowsingResponseAction] to take when hitting a malicious URL.
SafeBrowsingResponseAction action; SafeBrowsingResponseAction action;
SafeBrowsingResponse({this.report = true, SafeBrowsingResponse(
{this.report = true,
this.action = SafeBrowsingResponseAction.SHOW_INTERSTITIAL}); this.action = SafeBrowsingResponseAction.SHOW_INTERSTITIAL});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
...@@ -760,7 +772,8 @@ class HttpAuthResponse { ...@@ -760,7 +772,8 @@ class HttpAuthResponse {
///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge. ///Indicate the [HttpAuthResponseAction] to take in response of the authentication challenge.
HttpAuthResponseAction action; HttpAuthResponseAction action;
HttpAuthResponse({this.username = "", HttpAuthResponse(
{this.username = "",
this.password = "", this.password = "",
this.permanentPersistence = false, this.permanentPersistence = false,
this.action = HttpAuthResponseAction.CANCEL}); this.action = HttpAuthResponseAction.CANCEL});
...@@ -888,7 +901,8 @@ class ProtectionSpaceHttpAuthCredentials { ...@@ -888,7 +901,8 @@ class ProtectionSpaceHttpAuthCredentials {
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return { return {
"protectionSpace": protectionSpace?.toMap(), "protectionSpace": protectionSpace?.toMap(),
"credentials": credentials?.map((credential) => credential?.toMap())?.toList() "credentials":
credentials?.map((credential) => credential?.toMap())?.toList()
}; };
} }
...@@ -963,7 +977,8 @@ class ServerTrustChallenge { ...@@ -963,7 +977,8 @@ class ServerTrustChallenge {
///The SSL certificate used for this challenge. ///The SSL certificate used for this challenge.
SslCertificate sslCertificate; SslCertificate sslCertificate;
ServerTrustChallenge({@required this.protectionSpace, ServerTrustChallenge(
{@required this.protectionSpace,
this.androidError, this.androidError,
this.iosError, this.iosError,
this.message, this.message,
...@@ -1027,7 +1042,8 @@ class ClientCertResponse { ...@@ -1027,7 +1042,8 @@ class ClientCertResponse {
///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge. ///Indicate the [ClientCertResponseAction] to take in response of the client certificate challenge.
ClientCertResponseAction action; ClientCertResponseAction action;
ClientCertResponse({this.certificatePath, ClientCertResponse(
{this.certificatePath,
this.certificatePassword = "", this.certificatePassword = "",
this.androidKeyStoreType = "PKCS12", this.androidKeyStoreType = "PKCS12",
this.action = ClientCertResponseAction.CANCEL}) { this.action = ClientCertResponseAction.CANCEL}) {
...@@ -1123,7 +1139,9 @@ class AndroidCacheMode { ...@@ -1123,7 +1139,9 @@ class AndroidCacheMode {
static AndroidCacheMode fromValue(int value) { static AndroidCacheMode fromValue(int value) {
if (value != null) if (value != null)
return AndroidCacheMode.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidCacheMode.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1180,7 +1198,9 @@ class AndroidActionModeMenuItem { ...@@ -1180,7 +1198,9 @@ class AndroidActionModeMenuItem {
static AndroidActionModeMenuItem fromValue(int value) { static AndroidActionModeMenuItem fromValue(int value) {
if (value != null) if (value != null)
return AndroidActionModeMenuItem.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidActionModeMenuItem.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1237,7 +1257,9 @@ class AndroidForceDark { ...@@ -1237,7 +1257,9 @@ class AndroidForceDark {
static AndroidForceDark fromValue(int value) { static AndroidForceDark fromValue(int value) {
if (value != null) if (value != null)
return AndroidForceDark.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidForceDark.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1286,7 +1308,9 @@ class AndroidLayoutAlgorithm { ...@@ -1286,7 +1308,9 @@ class AndroidLayoutAlgorithm {
static AndroidLayoutAlgorithm fromValue(String value) { static AndroidLayoutAlgorithm fromValue(String value) {
if (value != null) if (value != null)
return AndroidLayoutAlgorithm.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidLayoutAlgorithm.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1331,7 +1355,9 @@ class AndroidMixedContentMode { ...@@ -1331,7 +1355,9 @@ class AndroidMixedContentMode {
static AndroidMixedContentMode fromValue(int value) { static AndroidMixedContentMode fromValue(int value) {
if (value != null) if (value != null)
return AndroidMixedContentMode.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidMixedContentMode.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1387,7 +1413,9 @@ class IOSWKSelectionGranularity { ...@@ -1387,7 +1413,9 @@ class IOSWKSelectionGranularity {
static IOSWKSelectionGranularity fromValue(int value) { static IOSWKSelectionGranularity fromValue(int value) {
if (value != null) if (value != null)
return IOSWKSelectionGranularity.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSWKSelectionGranularity.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1439,7 +1467,9 @@ class IOSWKDataDetectorTypes { ...@@ -1439,7 +1467,9 @@ class IOSWKDataDetectorTypes {
static IOSWKDataDetectorTypes fromValue(String value) { static IOSWKDataDetectorTypes fromValue(String value) {
if (value != null) if (value != null)
return IOSWKDataDetectorTypes.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSWKDataDetectorTypes.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1503,7 +1533,9 @@ class IOSUIScrollViewDecelerationRate { ...@@ -1503,7 +1533,9 @@ class IOSUIScrollViewDecelerationRate {
static IOSUIScrollViewDecelerationRate fromValue(String value) { static IOSUIScrollViewDecelerationRate fromValue(String value) {
if (value != null) if (value != null)
return IOSUIScrollViewDecelerationRate.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSUIScrollViewDecelerationRate.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1539,7 +1571,9 @@ class UserPreferredContentMode { ...@@ -1539,7 +1571,9 @@ class UserPreferredContentMode {
static UserPreferredContentMode fromValue(int value) { static UserPreferredContentMode fromValue(int value) {
if (value != null) if (value != null)
return UserPreferredContentMode.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return UserPreferredContentMode.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1594,7 +1628,9 @@ class IOSUIModalPresentationStyle { ...@@ -1594,7 +1628,9 @@ class IOSUIModalPresentationStyle {
static IOSUIModalPresentationStyle fromValue(int value) { static IOSUIModalPresentationStyle fromValue(int value) {
if (value != null) if (value != null)
return IOSUIModalPresentationStyle.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSUIModalPresentationStyle.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1682,7 +1718,9 @@ class IOSUIModalTransitionStyle { ...@@ -1682,7 +1718,9 @@ class IOSUIModalTransitionStyle {
static IOSUIModalTransitionStyle fromValue(int value) { static IOSUIModalTransitionStyle fromValue(int value) {
if (value != null) if (value != null)
return IOSUIModalTransitionStyle.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSUIModalTransitionStyle.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1743,7 +1781,9 @@ class IOSSafariDismissButtonStyle { ...@@ -1743,7 +1781,9 @@ class IOSSafariDismissButtonStyle {
static IOSSafariDismissButtonStyle fromValue(int value) { static IOSSafariDismissButtonStyle fromValue(int value) {
if (value != null) if (value != null)
return IOSSafariDismissButtonStyle.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSSafariDismissButtonStyle.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -1788,9 +1828,7 @@ class InAppWebViewGroupOptions { ...@@ -1788,9 +1828,7 @@ class InAppWebViewGroupOptions {
///iOS-specific options. ///iOS-specific options.
IOSInAppWebViewOptions ios; IOSInAppWebViewOptions ios;
InAppWebViewGroupOptions({this.crossPlatform, InAppWebViewGroupOptions({this.crossPlatform, this.android, this.ios}) {
this.android,
this.ios}) {
this.crossPlatform = this.crossPlatform ?? InAppWebViewOptions(); this.crossPlatform = this.crossPlatform ?? InAppWebViewOptions();
this.android = this.android ?? AndroidInAppWebViewOptions(); this.android = this.android ?? AndroidInAppWebViewOptions();
this.ios = this.ios ?? IOSInAppWebViewOptions(); this.ios = this.ios ?? IOSInAppWebViewOptions();
...@@ -1807,7 +1845,8 @@ class InAppWebViewGroupOptions { ...@@ -1807,7 +1845,8 @@ class InAppWebViewGroupOptions {
} }
static InAppWebViewGroupOptions fromMap(Map<String, dynamic> options) { static InAppWebViewGroupOptions fromMap(Map<String, dynamic> options) {
InAppWebViewGroupOptions inAppWebViewGroupOptions = InAppWebViewGroupOptions(); InAppWebViewGroupOptions inAppWebViewGroupOptions =
InAppWebViewGroupOptions();
inAppWebViewGroupOptions.crossPlatform = inAppWebViewGroupOptions.crossPlatform =
InAppWebViewOptions.fromMap(options); InAppWebViewOptions.fromMap(options);
...@@ -1848,7 +1887,8 @@ class InAppBrowserClassOptions { ...@@ -1848,7 +1887,8 @@ class InAppBrowserClassOptions {
///WebView options. ///WebView options.
InAppWebViewGroupOptions inAppWebViewGroupOptions; InAppWebViewGroupOptions inAppWebViewGroupOptions;
InAppBrowserClassOptions({this.crossPlatform, InAppBrowserClassOptions(
{this.crossPlatform,
this.android, this.android,
this.ios, this.ios,
this.inAppWebViewGroupOptions}) { this.inAppWebViewGroupOptions}) {
...@@ -1885,7 +1925,8 @@ class InAppBrowserClassOptions { ...@@ -1885,7 +1925,8 @@ class InAppBrowserClassOptions {
} }
static InAppBrowserClassOptions fromMap(Map<String, dynamic> options) { static InAppBrowserClassOptions fromMap(Map<String, dynamic> options) {
InAppBrowserClassOptions inAppBrowserClassOptions = InAppBrowserClassOptions(); InAppBrowserClassOptions inAppBrowserClassOptions =
InAppBrowserClassOptions();
inAppBrowserClassOptions.crossPlatform = inAppBrowserClassOptions.crossPlatform =
InAppBrowserOptions.fromMap(options); InAppBrowserOptions.fromMap(options);
...@@ -1920,10 +1961,7 @@ class ChromeSafariBrowserClassOptions { ...@@ -1920,10 +1961,7 @@ class ChromeSafariBrowserClassOptions {
///iOS-specific options. ///iOS-specific options.
IOSSafariOptions ios; IOSSafariOptions ios;
ChromeSafariBrowserClassOptions({ ChromeSafariBrowserClassOptions({this.android, this.ios}) {
this.android,
this.ios
}) {
this.android = this.android ?? AndroidChromeCustomTabsOptions(); this.android = this.android ?? AndroidChromeCustomTabsOptions();
this.ios = this.ios ?? IOSSafariOptions(); this.ios = this.ios ?? IOSSafariOptions();
} }
...@@ -2000,7 +2038,9 @@ class AjaxRequestEventType { ...@@ -2000,7 +2038,9 @@ class AjaxRequestEventType {
static AjaxRequestEventType fromValue(String value) { static AjaxRequestEventType fromValue(String value) {
if (value != null) if (value != null)
return AjaxRequestEventType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AjaxRequestEventType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2073,7 +2113,9 @@ class AjaxRequestReadyState { ...@@ -2073,7 +2113,9 @@ class AjaxRequestReadyState {
static AjaxRequestReadyState fromValue(int value) { static AjaxRequestReadyState fromValue(int value) {
if (value != null) if (value != null)
return AjaxRequestReadyState.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AjaxRequestReadyState.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2211,7 +2253,8 @@ class AjaxRequest { ...@@ -2211,7 +2253,8 @@ class AjaxRequest {
///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({this.data, AjaxRequest(
{this.data,
this.method, this.method,
this.url, this.url,
this.isAsync, this.isAsync,
...@@ -2450,7 +2493,8 @@ class FetchRequest { ...@@ -2450,7 +2493,8 @@ class FetchRequest {
///Indicates the [FetchRequestAction] that can be used to control the request. ///Indicates the [FetchRequestAction] that can be used to control the request.
FetchRequestAction action; FetchRequestAction action;
FetchRequest({this.url, FetchRequest(
{this.url,
this.method, this.method,
this.headers, this.headers,
this.body, this.body,
...@@ -2536,7 +2580,9 @@ class ContentBlockerTriggerResourceType { ...@@ -2536,7 +2580,9 @@ class ContentBlockerTriggerResourceType {
static ContentBlockerTriggerResourceType fromValue(String value) { static ContentBlockerTriggerResourceType fromValue(String value) {
if (value != null) if (value != null)
return ContentBlockerTriggerResourceType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ContentBlockerTriggerResourceType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2581,7 +2627,9 @@ class ContentBlockerTriggerLoadType { ...@@ -2581,7 +2627,9 @@ class ContentBlockerTriggerLoadType {
static ContentBlockerTriggerLoadType fromValue(String value) { static ContentBlockerTriggerLoadType fromValue(String value) {
if (value != null) if (value != null)
return ContentBlockerTriggerLoadType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ContentBlockerTriggerLoadType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2618,7 +2666,9 @@ class ContentBlockerActionType { ...@@ -2618,7 +2666,9 @@ class ContentBlockerActionType {
static ContentBlockerActionType fromValue(String value) { static ContentBlockerActionType fromValue(String value) {
if (value != null) if (value != null)
return ContentBlockerActionType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return ContentBlockerActionType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2689,7 +2739,8 @@ class Cookie { ...@@ -2689,7 +2739,8 @@ class Cookie {
///**NOTE**: on Android it will be always `null`. ///**NOTE**: on Android it will be always `null`.
String path; String path;
Cookie({@required this.name, Cookie(
{@required this.name,
@required this.value, @required this.value,
this.expiresDate, this.expiresDate,
this.isSessionOnly, this.isSessionOnly,
...@@ -2751,7 +2802,8 @@ class PermissionRequestResponse { ...@@ -2751,7 +2802,8 @@ class PermissionRequestResponse {
///Indicate the [PermissionRequestResponseAction] to take in response of a permission request. ///Indicate the [PermissionRequestResponseAction] to take in response of a permission request.
PermissionRequestResponseAction action; PermissionRequestResponseAction action;
PermissionRequestResponse({this.resources = const [], PermissionRequestResponse(
{this.resources = const [],
this.action = PermissionRequestResponseAction.DENY}); this.action = PermissionRequestResponseAction.DENY});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
...@@ -2812,7 +2864,9 @@ class IOSWKNavigationType { ...@@ -2812,7 +2864,9 @@ class IOSWKNavigationType {
static IOSWKNavigationType fromValue(int value) { static IOSWKNavigationType fromValue(int value) {
if (value != null) if (value != null)
return IOSWKNavigationType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSWKNavigationType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -2870,7 +2924,8 @@ class ShouldOverrideUrlLoadingRequest { ...@@ -2870,7 +2924,8 @@ class ShouldOverrideUrlLoadingRequest {
///The type of action triggering the navigation. Available only on iOS. ///The type of action triggering the navigation. Available only on iOS.
IOSWKNavigationType iosWKNavigationType; IOSWKNavigationType iosWKNavigationType;
ShouldOverrideUrlLoadingRequest({this.url, ShouldOverrideUrlLoadingRequest(
{this.url,
this.method, this.method,
this.headers, this.headers,
this.isForMainFrame, this.isForMainFrame,
...@@ -2914,7 +2969,8 @@ class OnCreateWindowRequest { ...@@ -2914,7 +2969,8 @@ class OnCreateWindowRequest {
///The type of action triggering the navigation. Available only on iOS. ///The type of action triggering the navigation. Available only on iOS.
IOSWKNavigationType iosWKNavigationType; IOSWKNavigationType iosWKNavigationType;
OnCreateWindowRequest({this.url, OnCreateWindowRequest(
{this.url,
this.androidIsDialog, this.androidIsDialog,
this.androidIsUserGesture, this.androidIsUserGesture,
this.iosWKNavigationType}); this.iosWKNavigationType});
...@@ -2989,7 +3045,9 @@ class IOSWKWebsiteDataType { ...@@ -2989,7 +3045,9 @@ class IOSWKWebsiteDataType {
static IOSWKWebsiteDataType fromValue(String value) { static IOSWKWebsiteDataType fromValue(String value) {
if (value != null) if (value != null)
return IOSWKWebsiteDataType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSWKWebsiteDataType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3116,7 +3174,9 @@ class InAppWebViewHitTestResultType { ...@@ -3116,7 +3174,9 @@ class InAppWebViewHitTestResultType {
static InAppWebViewHitTestResultType fromValue(int value) { static InAppWebViewHitTestResultType fromValue(int value) {
if (value != null) if (value != null)
return InAppWebViewHitTestResultType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return InAppWebViewHitTestResultType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3269,7 +3329,9 @@ class RendererPriority { ...@@ -3269,7 +3329,9 @@ class RendererPriority {
static RendererPriority fromValue(int value) { static RendererPriority fromValue(int value) {
if (value != null) if (value != null)
return RendererPriority.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return RendererPriority.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3318,7 +3380,8 @@ class RendererPriorityPolicy { ...@@ -3318,7 +3380,8 @@ class RendererPriorityPolicy {
///If true, this flag specifies that when this WebView is not visible, it will be treated as if it had requested a priority of [RendererPriority.RENDERER_PRIORITY_WAIVED]. ///If true, this flag specifies that when this WebView is not visible, it will be treated as if it had requested a priority of [RendererPriority.RENDERER_PRIORITY_WAIVED].
bool waivedWhenNotVisible; bool waivedWhenNotVisible;
RendererPriorityPolicy({@required this.rendererRequestedPriority, RendererPriorityPolicy(
{@required this.rendererRequestedPriority,
@required this.waivedWhenNotVisible}); @required this.waivedWhenNotVisible});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
...@@ -3395,7 +3458,9 @@ class AndroidOverScrollMode { ...@@ -3395,7 +3458,9 @@ class AndroidOverScrollMode {
static AndroidOverScrollMode fromValue(int value) { static AndroidOverScrollMode fromValue(int value) {
if (value != null) if (value != null)
return AndroidOverScrollMode.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidOverScrollMode.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3451,7 +3516,9 @@ class AndroidScrollBarStyle { ...@@ -3451,7 +3516,9 @@ class AndroidScrollBarStyle {
static AndroidScrollBarStyle fromValue(int value) { static AndroidScrollBarStyle fromValue(int value) {
if (value != null) if (value != null)
return AndroidScrollBarStyle.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidScrollBarStyle.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3512,7 +3579,9 @@ class AndroidVerticalScrollbarPosition { ...@@ -3512,7 +3579,9 @@ class AndroidVerticalScrollbarPosition {
static AndroidVerticalScrollbarPosition fromValue(int value) { static AndroidVerticalScrollbarPosition fromValue(int value) {
if (value != null) if (value != null)
return AndroidVerticalScrollbarPosition.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidVerticalScrollbarPosition.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3698,7 +3767,9 @@ class WebStorageType { ...@@ -3698,7 +3767,9 @@ class WebStorageType {
static WebStorageType fromValue(String value) { static WebStorageType fromValue(String value) {
if (value != null) if (value != null)
return WebStorageType.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return WebStorageType.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3735,7 +3806,9 @@ class HTTPCookieSameSitePolicy { ...@@ -3735,7 +3806,9 @@ class HTTPCookieSameSitePolicy {
static HTTPCookieSameSitePolicy fromValue(String value) { static HTTPCookieSameSitePolicy fromValue(String value) {
if (value != null) if (value != null)
return HTTPCookieSameSitePolicy.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return HTTPCookieSameSitePolicy.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3785,7 +3858,9 @@ class AndroidSslError { ...@@ -3785,7 +3858,9 @@ class AndroidSslError {
static AndroidSslError fromValue(int value) { static AndroidSslError fromValue(int value) {
if (value != null) if (value != null)
return AndroidSslError.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return AndroidSslError.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3852,7 +3927,9 @@ class IOSSslError { ...@@ -3852,7 +3927,9 @@ class IOSSslError {
static IOSSslError fromValue(int value) { static IOSSslError fromValue(int value) {
if (value != null) if (value != null)
return IOSSslError.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSSslError.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3918,7 +3995,9 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior { ...@@ -3918,7 +3995,9 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior {
static IOSUIScrollViewContentInsetAdjustmentBehavior fromValue(int value) { static IOSUIScrollViewContentInsetAdjustmentBehavior fromValue(int value) {
if (value != null) if (value != null)
return IOSUIScrollViewContentInsetAdjustmentBehavior.values.firstWhere((element) => element.toValue() == value, orElse: () => null); return IOSUIScrollViewContentInsetAdjustmentBehavior.values.firstWhere(
(element) => element.toValue() == value,
orElse: () => null);
return null; return null;
} }
...@@ -3940,20 +4019,20 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior { ...@@ -3940,20 +4019,20 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior {
} }
///Automatically adjust the scroll view insets. ///Automatically adjust the scroll view insets.
static const AUTOMATIC = const IOSUIScrollViewContentInsetAdjustmentBehavior static const AUTOMATIC =
._internal(0); const IOSUIScrollViewContentInsetAdjustmentBehavior._internal(0);
///Adjust the insets only in the scrollable directions. ///Adjust the insets only in the scrollable directions.
static const SCROLLABLE_AXES = const IOSUIScrollViewContentInsetAdjustmentBehavior static const SCROLLABLE_AXES =
._internal(1); const IOSUIScrollViewContentInsetAdjustmentBehavior._internal(1);
///Do not adjust the scroll view insets. ///Do not adjust the scroll view insets.
static const NEVER = const IOSUIScrollViewContentInsetAdjustmentBehavior static const NEVER =
._internal(2); const IOSUIScrollViewContentInsetAdjustmentBehavior._internal(2);
///Always include the safe area insets in the content adjustment. ///Always include the safe area insets in the content adjustment.
static const ALWAYS = const IOSUIScrollViewContentInsetAdjustmentBehavior static const ALWAYS =
._internal(3); const IOSUIScrollViewContentInsetAdjustmentBehavior._internal(3);
bool operator ==(value) => value == _value; bool operator ==(value) => value == _value;
...@@ -3963,7 +4042,6 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior { ...@@ -3963,7 +4042,6 @@ class IOSUIScrollViewContentInsetAdjustmentBehavior {
///SSL certificate info (certificate details) class. ///SSL certificate info (certificate details) class.
class SslCertificate { class SslCertificate {
///Name of the entity this certificate is issued by ///Name of the entity this certificate is issued by
SslCertificateDName issuedBy; SslCertificateDName issuedBy;
...@@ -3979,13 +4057,12 @@ class SslCertificate { ...@@ -3979,13 +4057,12 @@ 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,
this.validNotBeforeDate, this.validNotBeforeDate,
this.x509Certificate this.x509Certificate});
});
static SslCertificate fromMap(Map<String, dynamic> map) { static SslCertificate fromMap(Map<String, dynamic> map) {
X509Certificate x509Certificate; X509Certificate x509Certificate;
...@@ -3996,17 +4073,19 @@ class SslCertificate { ...@@ -3996,17 +4073,19 @@ class SslCertificate {
print(stacktrace); print(stacktrace);
} }
return map != null ? SslCertificate( return map != null
? SslCertificate(
issuedBy: SslCertificateDName.fromMap( issuedBy: SslCertificateDName.fromMap(
map["issuedBy"]?.cast<String, dynamic>()), map["issuedBy"]?.cast<String, dynamic>()),
issuedTo: SslCertificateDName.fromMap( issuedTo: SslCertificateDName.fromMap(
map["issuedTo"]?.cast<String, dynamic>()), map["issuedTo"]?.cast<String, dynamic>()),
validNotAfterDate: DateTime.fromMillisecondsSinceEpoch( validNotAfterDate:
map["validNotAfterDate"]), DateTime.fromMillisecondsSinceEpoch(map["validNotAfterDate"]),
validNotBeforeDate: DateTime.fromMillisecondsSinceEpoch( validNotBeforeDate:
map["validNotBeforeDate"]), DateTime.fromMillisecondsSinceEpoch(map["validNotBeforeDate"]),
x509Certificate: x509Certificate, x509Certificate: x509Certificate,
) : null; )
: null;
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
...@@ -4049,15 +4128,20 @@ class SslCertificateDName { ...@@ -4049,15 +4128,20 @@ class SslCertificateDName {
SslCertificateDName( SslCertificateDName(
// ignore: non_constant_identifier_names // ignore: non_constant_identifier_names
{this.CName = "", this.DName = "", this.OName = "", this.UName = ""}); {this.CName = "",
this.DName = "",
this.OName = "",
this.UName = ""});
static SslCertificateDName fromMap(Map<String, dynamic> map) { static SslCertificateDName fromMap(Map<String, dynamic> map) {
return map != null ? SslCertificateDName( return map != null
? SslCertificateDName(
CName: map["CName"] ?? "", CName: map["CName"] ?? "",
DName: map["DName"] ?? "", DName: map["DName"] ?? "",
OName: map["OName"] ?? "", OName: map["OName"] ?? "",
UName: map["UName"] ?? "", UName: map["UName"] ?? "",
) : null; )
: null;
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
......
...@@ -15,7 +15,6 @@ class Util { ...@@ -15,7 +15,6 @@ class Util {
} else if (colorValue.startsWith("hlsa(")) { } else if (colorValue.startsWith("hlsa(")) {
return Util.getColorFromHlsaString(colorValue); return Util.getColorFromHlsaString(colorValue);
} else { } else {
/** /**
This part of the code is generated using the JavaScript code below on this link: https://drafts.csswg.org/css-color/#typedef-color This part of the code is generated using the JavaScript code below on this link: https://drafts.csswg.org/css-color/#typedef-color
...@@ -33,7 +32,7 @@ class Util { ...@@ -33,7 +32,7 @@ class Util {
code += '}'; code += '}';
*/ */
switch(colorValue) { switch (colorValue) {
case "aliceblue": case "aliceblue":
return Util.getColorFromHex("#f0f8ff"); return Util.getColorFromHex("#f0f8ff");
case "antiquewhite": case "antiquewhite":
...@@ -337,8 +336,10 @@ class Util { ...@@ -337,8 +336,10 @@ class Util {
static Color getColorFromHex(String hexString) { static Color getColorFromHex(String hexString) {
hexString = hexString.trim(); hexString = hexString.trim();
if (hexString.length == 4) { // convert for example #f00 to #ff0000 if (hexString.length == 4) {
hexString = "#" + (hexString[1] * 2) + (hexString[2] * 2) + (hexString[3] * 2); // convert for example #f00 to #ff0000
hexString =
"#" + (hexString[1] * 2) + (hexString[2] * 2) + (hexString[3] * 2);
} }
final buffer = StringBuffer(); final buffer = StringBuffer();
if (hexString.length == 6 || hexString.length == 7) buffer.write('ff'); if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
...@@ -363,7 +364,8 @@ class Util { ...@@ -363,7 +364,8 @@ class Util {
.split(",") .split(",")
.map((rbgValue) => rbgValue.trim()) .map((rbgValue) => rbgValue.trim())
.toList(); .toList();
return Color.fromRGBO(int.parse(rgbaValues[0]), int.parse(rgbaValues[1]), int.parse(rgbaValues[2]), double.parse(rgbaValues[3])); return Color.fromRGBO(int.parse(rgbaValues[0]), int.parse(rgbaValues[1]),
int.parse(rgbaValues[2]), double.parse(rgbaValues[3]));
} }
static Color getColorFromHlsString(String hlsString) { static Color getColorFromHlsString(String hlsString) {
...@@ -385,10 +387,11 @@ class Util { ...@@ -385,10 +387,11 @@ class Util {
.map((rbgValue) => double.parse(rbgValue.trim())) .map((rbgValue) => double.parse(rbgValue.trim()))
.toList(); .toList();
var rgbaValues = hslToRgb(hlsaValues[0], hlsaValues[1], hlsaValues[2]); var rgbaValues = hslToRgb(hlsaValues[0], hlsaValues[1], hlsaValues[2]);
return Color.fromRGBO(rgbaValues[0], rgbaValues[1], rgbaValues[2], hlsaValues[3]); return Color.fromRGBO(
rgbaValues[0], rgbaValues[1], rgbaValues[2], hlsaValues[3]);
} }
static List<num> hslToRgb(double h, double s, double l){ static List<num> hslToRgb(double h, double s, double l) {
double r, g, b; double r, g, b;
if (s == 0) { if (s == 0) {
...@@ -396,30 +399,25 @@ class Util { ...@@ -396,30 +399,25 @@ class Util {
} else { } else {
double q = l < 0.5 ? l * (1 + s) : l + s - l * s; double q = l < 0.5 ? l * (1 + s) : l + s - l * s;
double p = 2 * l - q; double p = 2 * l - q;
r = hueToRgb(p, q, h + 1/3); r = hueToRgb(p, q, h + 1 / 3);
g = hueToRgb(p, q, h); g = hueToRgb(p, q, h);
b = hueToRgb(p, q, h - 1/3); b = hueToRgb(p, q, h - 1 / 3);
} }
var rgb = [to255(r), to255(g), to255(b)]; var rgb = [to255(r), to255(g), to255(b)];
return rgb; return rgb;
} }
static num to255(double v) { static num to255(double v) {
return min(255, 256*v); return min(255, 256 * v);
} }
/// Helper method that converts hue to rgb /// Helper method that converts hue to rgb
static double hueToRgb(double p, double q, double t) { static double hueToRgb(double p, double q, double t) {
if (t < 0) if (t < 0) t += 1;
t += 1; if (t > 1) t -= 1;
if (t > 1) if (t < 1 / 6) return p + (q - p) * 6 * t;
t -= 1; if (t < 1 / 2) return q;
if (t < 1/6) if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p + (q - p) * 6 * t;
if (t < 1/2)
return q;
if (t < 2/3)
return p + (q - p) * (2/3 - t) * 6;
return p; return p;
} }
} }
...@@ -54,7 +54,7 @@ class Storage { ...@@ -54,7 +54,7 @@ class Storage {
Future<void> setItem({@required String key, @required dynamic value}) async { Future<void> setItem({@required String key, @required dynamic value}) async {
var encodedValue = json.encode(value); var encodedValue = json.encode(value);
await _controller.evaluateJavascript(source: """ await _controller.evaluateJavascript(source: """
window.$webStorageType.setItem("$key", ${ value is String ? encodedValue : "JSON.stringify($encodedValue)" }); window.$webStorageType.setItem("$key", ${value is String ? encodedValue : "JSON.stringify($encodedValue)"});
"""); """);
} }
...@@ -81,10 +81,10 @@ class Storage { ...@@ -81,10 +81,10 @@ class Storage {
} }
Future<List<WebStorageItem>> getItems() async { Future<List<WebStorageItem>> getItems() async {
var webStorageItems = <WebStorageItem>[]; var webStorageItems = <WebStorageItem>[];
List<Map<dynamic, dynamic>> items = (await _controller.evaluateJavascript(source: """ List<Map<dynamic, dynamic>> items =
(await _controller.evaluateJavascript(source: """
(function() { (function() {
var webStorageItems = []; var webStorageItems = [];
for(var i = 0; i < window.$webStorageType.length; i++){ for(var i = 0; i < window.$webStorageType.length; i++){
...@@ -105,9 +105,8 @@ class Storage { ...@@ -105,9 +105,8 @@ class Storage {
} }
for (var item in items) { for (var item in items) {
webStorageItems.add( webStorageItems
WebStorageItem(key: item["key"], value: item["value"]) .add(WebStorageItem(key: item["key"], value: item["value"]));
);
} }
return webStorageItems; return webStorageItems;
...@@ -128,9 +127,11 @@ class Storage { ...@@ -128,9 +127,11 @@ class Storage {
} }
class LocalStorage extends Storage { class LocalStorage extends Storage {
LocalStorage(InAppWebViewController controller) : super(controller, WebStorageType.LOCAL_STORAGE); LocalStorage(InAppWebViewController controller)
: super(controller, WebStorageType.LOCAL_STORAGE);
} }
class SessionStorage extends Storage { class SessionStorage extends Storage {
SessionStorage(InAppWebViewController controller) : super(controller, WebStorageType.SESSION_STORAGE); SessionStorage(InAppWebViewController controller)
: super(controller, WebStorageType.SESSION_STORAGE);
} }
...@@ -838,7 +838,8 @@ class IOSInAppWebViewOptions ...@@ -838,7 +838,8 @@ class IOSInAppWebViewOptions
this.isPagingEnabled = false, this.isPagingEnabled = false,
this.maximumZoomScale = 1.0, this.maximumZoomScale = 1.0,
this.minimumZoomScale = 1.0, this.minimumZoomScale = 1.0,
this.contentInsetAdjustmentBehavior = IOSUIScrollViewContentInsetAdjustmentBehavior.NEVER}); this.contentInsetAdjustmentBehavior =
IOSUIScrollViewContentInsetAdjustmentBehavior.NEVER});
@override @override
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment