diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
deleted file mode 100644
index 3d5970d9..00000000
--- a/.idea/libraries/Dart_Packages.xml
+++ /dev/null
@@ -1,772 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
index 31799730..c241dc8c 100755
--- a/.idea/libraries/Flutter_Plugins.xml
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -1,6 +1,9 @@
-
+
+
+
+
diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies
index c7ba9039..e6799223 100644
--- a/example/.flutter-plugins-dependencies
+++ b/example/.flutter-plugins-dependencies
@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":["device_info"]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"android":[{"name":"device_info","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":["device_info"]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/","dependencies":[]},{"name":"url_launcher_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/","dependencies":[]},{"name":"url_launcher_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"device_info","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["device_info"]},{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2021-02-22 23:35:30.325662","version":"1.27.0-5.0.pre.90"}
\ No newline at end of file
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"device_info","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":["device_info"]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"android":[{"name":"device_info","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":["device_info"]},{"name":"integration_test","path":"/Users/lorenzopichilli/flutter/packages/integration_test/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/","dependencies":[]},{"name":"url_launcher","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/","dependencies":[]},{"name":"url_launcher_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/","dependencies":[]},{"name":"url_launcher_linux","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/","dependencies":[]},{"name":"url_launcher_windows","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/","dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"device_info","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["device_info"]},{"name":"integration_test","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2021-02-22 23:52:14.900647","version":"1.27.0-5.0.pre.90"}
\ No newline at end of file
diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh
index b59a9d8e..ff2151af 100755
--- a/example/ios/Flutter/flutter_export_environment.sh
+++ b/example/ios/Flutter/flutter_export_environment.sh
@@ -2,12 +2,12 @@
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/lorenzopichilli/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example"
-export "FLUTTER_TARGET=integration_test/webview_flutter_test.dart"
+export "FLUTTER_TARGET=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example/lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
-export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
+export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
diff --git a/flutter_inappwebview.iml b/flutter_inappwebview.iml
index 4cb39159..0adae5aa 100755
--- a/flutter_inappwebview.iml
+++ b/flutter_inappwebview.iml
@@ -80,6 +80,5 @@
-
\ No newline at end of file
diff --git a/lib/flutter_inappwebview.dart b/lib/flutter_inappwebview.dart
index aeef7034..5d49df01 100755
--- a/lib/flutter_inappwebview.dart
+++ b/lib/flutter_inappwebview.dart
@@ -21,4 +21,4 @@
library flutter_inappwebview;
-export 'src/main.dart';
\ No newline at end of file
+export 'src/main.dart';
diff --git a/lib/src/_uuid_generator.dart b/lib/src/_uuid_generator.dart
index 9d603455..883d290c 100644
--- a/lib/src/_uuid_generator.dart
+++ b/lib/src/_uuid_generator.dart
@@ -1,3 +1,3 @@
import 'package:uuid/uuid.dart';
-final UUID_GENERATOR = Uuid();
\ No newline at end of file
+final UUID_GENERATOR = Uuid();
diff --git a/lib/src/android/service_worker_controller.dart b/lib/src/android/service_worker_controller.dart
index d4bfb7c0..2d364e45 100644
--- a/lib/src/android/service_worker_controller.dart
+++ b/lib/src/android/service_worker_controller.dart
@@ -27,17 +27,21 @@ class AndroidServiceWorkerController {
}
static Future _handleMethod(MethodCall call) async {
- AndroidServiceWorkerController controller = AndroidServiceWorkerController.instance();
- AndroidServiceWorkerClient? serviceWorkerClient = controller.serviceWorkerClient;
+ AndroidServiceWorkerController controller =
+ AndroidServiceWorkerController.instance();
+ AndroidServiceWorkerClient? serviceWorkerClient =
+ controller.serviceWorkerClient;
switch (call.method) {
case "shouldInterceptRequest":
- if (serviceWorkerClient != null && serviceWorkerClient.shouldInterceptRequest != null) {
- Map arguments = call.arguments.cast();
+ if (serviceWorkerClient != null &&
+ serviceWorkerClient.shouldInterceptRequest != null) {
+ Map arguments =
+ call.arguments.cast();
WebResourceRequest request = WebResourceRequest.fromMap(arguments)!;
return (await serviceWorkerClient.shouldInterceptRequest!(request))
- ?.toMap();
+ ?.toMap();
}
break;
default:
@@ -88,7 +92,8 @@ class AndroidServiceWorkerController {
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getCacheMode()
static Future getCacheMode() async {
Map args = {};
- return AndroidCacheMode.fromValue(await _channel.invokeMethod('getCacheMode', args));
+ return AndroidCacheMode.fromValue(
+ await _channel.invokeMethod('getCacheMode', args));
}
///Enables or disables content URL access from Service Workers.
@@ -146,7 +151,6 @@ class AndroidServiceWorkerController {
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerClientCompat
class AndroidServiceWorkerClient {
-
///Notify the host application of a resource request and allow the application to return the data.
///If the return value is `null`, the Service Worker will continue to load the resource as usual.
///Otherwise, the return response and data will be used.
@@ -158,9 +162,7 @@ class AndroidServiceWorkerClient {
///
///**NOTE**: available on Android 24+.
final Future Function(WebResourceRequest request)?
- shouldInterceptRequest;
+ shouldInterceptRequest;
- AndroidServiceWorkerClient({
- this.shouldInterceptRequest
- });
-}
\ No newline at end of file
+ AndroidServiceWorkerClient({this.shouldInterceptRequest});
+}
diff --git a/lib/src/android/webview_feature.dart b/lib/src/android/webview_feature.dart
index d30e7bf0..839547c2 100644
--- a/lib/src/android/webview_feature.dart
+++ b/lib/src/android/webview_feature.dart
@@ -59,8 +59,8 @@ class AndroidWebViewFeature {
static AndroidWebViewFeature? fromValue(String? value) {
if (value != null) {
try {
- return AndroidWebViewFeature.values.firstWhere(
- (element) => element.toValue() == value);
+ return AndroidWebViewFeature.values
+ .firstWhere((element) => element.toValue() == value);
} catch (e) {
return null;
}
@@ -74,127 +74,174 @@ class AndroidWebViewFeature {
String toString() => _value;
///
- static const CREATE_WEB_MESSAGE_CHANNEL = const AndroidWebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL");
+ static const CREATE_WEB_MESSAGE_CHANNEL =
+ const AndroidWebViewFeature._internal("CREATE_WEB_MESSAGE_CHANNEL");
///
- static const DISABLED_ACTION_MODE_MENU_ITEMS = const AndroidWebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
+ static const DISABLED_ACTION_MODE_MENU_ITEMS =
+ const AndroidWebViewFeature._internal("DISABLED_ACTION_MODE_MENU_ITEMS");
///
static const FORCE_DARK = const AndroidWebViewFeature._internal("FORCE_DARK");
///
- static const FORCE_DARK_STRATEGY = const AndroidWebViewFeature._internal("FORCE_DARK_STRATEGY");
+ static const FORCE_DARK_STRATEGY =
+ const AndroidWebViewFeature._internal("FORCE_DARK_STRATEGY");
///
- static const GET_WEB_CHROME_CLIENT = const AndroidWebViewFeature._internal("GET_WEB_CHROME_CLIENT");
+ static const GET_WEB_CHROME_CLIENT =
+ const AndroidWebViewFeature._internal("GET_WEB_CHROME_CLIENT");
///
- static const GET_WEB_VIEW_CLIENT = const AndroidWebViewFeature._internal("GET_WEB_VIEW_CLIENT");
+ static const GET_WEB_VIEW_CLIENT =
+ const AndroidWebViewFeature._internal("GET_WEB_VIEW_CLIENT");
///
- static const GET_WEB_VIEW_RENDERER = const AndroidWebViewFeature._internal("GET_WEB_VIEW_RENDERER");
+ static const GET_WEB_VIEW_RENDERER =
+ const AndroidWebViewFeature._internal("GET_WEB_VIEW_RENDERER");
///
- static const MULTI_PROCESS = const AndroidWebViewFeature._internal("MULTI_PROCESS");
+ static const MULTI_PROCESS =
+ const AndroidWebViewFeature._internal("MULTI_PROCESS");
///
- static const OFF_SCREEN_PRERASTER = const AndroidWebViewFeature._internal("OFF_SCREEN_PRERASTER");
+ static const OFF_SCREEN_PRERASTER =
+ const AndroidWebViewFeature._internal("OFF_SCREEN_PRERASTER");
///
- static const POST_WEB_MESSAGE = const AndroidWebViewFeature._internal("POST_WEB_MESSAGE");
+ static const POST_WEB_MESSAGE =
+ const AndroidWebViewFeature._internal("POST_WEB_MESSAGE");
///
- static const PROXY_OVERRIDE = const AndroidWebViewFeature._internal("PROXY_OVERRIDE");
+ static const PROXY_OVERRIDE =
+ const AndroidWebViewFeature._internal("PROXY_OVERRIDE");
///
- static const RECEIVE_HTTP_ERROR = const AndroidWebViewFeature._internal("RECEIVE_HTTP_ERROR");
+ static const RECEIVE_HTTP_ERROR =
+ const AndroidWebViewFeature._internal("RECEIVE_HTTP_ERROR");
///
- static const RECEIVE_WEB_RESOURCE_ERROR = const AndroidWebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR");
+ static const RECEIVE_WEB_RESOURCE_ERROR =
+ const AndroidWebViewFeature._internal("RECEIVE_WEB_RESOURCE_ERROR");
///
- static const SAFE_BROWSING_ALLOWLIST = const AndroidWebViewFeature._internal("SAFE_BROWSING_ALLOWLIST");
+ static const SAFE_BROWSING_ALLOWLIST =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_ALLOWLIST");
///
- static const SAFE_BROWSING_ENABLE = const AndroidWebViewFeature._internal("SAFE_BROWSING_ENABLE");
+ static const SAFE_BROWSING_ENABLE =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_ENABLE");
///
- static const SAFE_BROWSING_HIT = const AndroidWebViewFeature._internal("SAFE_BROWSING_HIT");
+ static const SAFE_BROWSING_HIT =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_HIT");
///
- static const SAFE_BROWSING_PRIVACY_POLICY_URL = const AndroidWebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
+ static const SAFE_BROWSING_PRIVACY_POLICY_URL =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_PRIVACY_POLICY_URL");
///
- static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY = const AndroidWebViewFeature._internal("SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY");
+ static const SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY =
+ const AndroidWebViewFeature._internal(
+ "SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY");
///
- static const SAFE_BROWSING_RESPONSE_PROCEED = const AndroidWebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED");
+ static const SAFE_BROWSING_RESPONSE_PROCEED =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_RESPONSE_PROCEED");
///
- static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL = const AndroidWebViewFeature._internal("SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL");
+ static const SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL =
+ const AndroidWebViewFeature._internal(
+ "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL");
///
- static const SAFE_BROWSING_WHITELIST = const AndroidWebViewFeature._internal("SAFE_BROWSING_WHITELIST");
+ static const SAFE_BROWSING_WHITELIST =
+ const AndroidWebViewFeature._internal("SAFE_BROWSING_WHITELIST");
///
- static const SERVICE_WORKER_BASIC_USAGE = const AndroidWebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE");
+ static const SERVICE_WORKER_BASIC_USAGE =
+ const AndroidWebViewFeature._internal("SERVICE_WORKER_BASIC_USAGE");
///
- static const SERVICE_WORKER_BLOCK_NETWORK_LOADS = const AndroidWebViewFeature._internal("SERVICE_WORKER_BLOCK_NETWORK_LOADS");
+ static const SERVICE_WORKER_BLOCK_NETWORK_LOADS =
+ const AndroidWebViewFeature._internal(
+ "SERVICE_WORKER_BLOCK_NETWORK_LOADS");
///
- static const SERVICE_WORKER_CACHE_MODE = const AndroidWebViewFeature._internal("SERVICE_WORKER_CACHE_MODE");
+ static const SERVICE_WORKER_CACHE_MODE =
+ const AndroidWebViewFeature._internal("SERVICE_WORKER_CACHE_MODE");
///
- static const SERVICE_WORKER_CONTENT_ACCESS = const AndroidWebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS");
+ static const SERVICE_WORKER_CONTENT_ACCESS =
+ const AndroidWebViewFeature._internal("SERVICE_WORKER_CONTENT_ACCESS");
///
- static const SERVICE_WORKER_FILE_ACCESS = const AndroidWebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS");
+ static const SERVICE_WORKER_FILE_ACCESS =
+ const AndroidWebViewFeature._internal("SERVICE_WORKER_FILE_ACCESS");
///
- static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST = const AndroidWebViewFeature._internal("SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST");
+ static const SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST =
+ const AndroidWebViewFeature._internal(
+ "SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST");
///
- static const SHOULD_OVERRIDE_WITH_REDIRECTS = const AndroidWebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
+ static const SHOULD_OVERRIDE_WITH_REDIRECTS =
+ const AndroidWebViewFeature._internal("SHOULD_OVERRIDE_WITH_REDIRECTS");
///
- static const START_SAFE_BROWSING = const AndroidWebViewFeature._internal("START_SAFE_BROWSING");
+ static const START_SAFE_BROWSING =
+ const AndroidWebViewFeature._internal("START_SAFE_BROWSING");
///
- static const TRACING_CONTROLLER_BASIC_USAGE = const AndroidWebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE");
+ static const TRACING_CONTROLLER_BASIC_USAGE =
+ const AndroidWebViewFeature._internal("TRACING_CONTROLLER_BASIC_USAGE");
///
- static const VISUAL_STATE_CALLBACK = const AndroidWebViewFeature._internal("VISUAL_STATE_CALLBACK");
+ static const VISUAL_STATE_CALLBACK =
+ const AndroidWebViewFeature._internal("VISUAL_STATE_CALLBACK");
///
- static const WEB_MESSAGE_CALLBACK_ON_MESSAGE = const AndroidWebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
+ static const WEB_MESSAGE_CALLBACK_ON_MESSAGE =
+ const AndroidWebViewFeature._internal("WEB_MESSAGE_CALLBACK_ON_MESSAGE");
///
- static const WEB_MESSAGE_LISTENER = const AndroidWebViewFeature._internal("WEB_MESSAGE_LISTENER");
+ static const WEB_MESSAGE_LISTENER =
+ const AndroidWebViewFeature._internal("WEB_MESSAGE_LISTENER");
///
- static const WEB_MESSAGE_PORT_CLOSE = const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE");
+ static const WEB_MESSAGE_PORT_CLOSE =
+ const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_CLOSE");
///
- static const WEB_MESSAGE_PORT_POST_MESSAGE = const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
+ static const WEB_MESSAGE_PORT_POST_MESSAGE =
+ const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_POST_MESSAGE");
///
- static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK = const AndroidWebViewFeature._internal("WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK");
+ static const WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK =
+ const AndroidWebViewFeature._internal(
+ "WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK");
///
- static const WEB_RESOURCE_ERROR_GET_CODE = const AndroidWebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE");
+ static const WEB_RESOURCE_ERROR_GET_CODE =
+ const AndroidWebViewFeature._internal("WEB_RESOURCE_ERROR_GET_CODE");
///
- static const WEB_RESOURCE_ERROR_GET_DESCRIPTION = const AndroidWebViewFeature._internal("WEB_RESOURCE_ERROR_GET_DESCRIPTION");
+ static const WEB_RESOURCE_ERROR_GET_DESCRIPTION =
+ const AndroidWebViewFeature._internal(
+ "WEB_RESOURCE_ERROR_GET_DESCRIPTION");
///
- static const WEB_RESOURCE_REQUEST_IS_REDIRECT = const AndroidWebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
+ static const WEB_RESOURCE_REQUEST_IS_REDIRECT =
+ const AndroidWebViewFeature._internal("WEB_RESOURCE_REQUEST_IS_REDIRECT");
///
- static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = const AndroidWebViewFeature._internal("WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE");
+ static const WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE =
+ const AndroidWebViewFeature._internal(
+ "WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE");
///
- static const WEB_VIEW_RENDERER_TERMINATE = const AndroidWebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE");
+ static const WEB_VIEW_RENDERER_TERMINATE =
+ const AndroidWebViewFeature._internal("WEB_VIEW_RENDERER_TERMINATE");
bool operator ==(value) => value == _value;
@@ -211,4 +258,4 @@ class AndroidWebViewFeature {
args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args);
}
-}
\ No newline at end of file
+}
diff --git a/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart b/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart
index 3350acf2..d6901bb8 100755
--- a/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart
+++ b/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart
@@ -62,7 +62,8 @@ class AndroidChromeCustomTabsOptions
new AndroidChromeCustomTabsOptions();
options.addDefaultShareMenuItem = map["addDefaultShareMenuItem"];
options.showTitle = map["showTitle"];
- options.toolbarBackgroundColor = UtilColor.fromHex(map["toolbarBackgroundColor"]);
+ options.toolbarBackgroundColor =
+ UtilColor.fromHex(map["toolbarBackgroundColor"]);
options.enableUrlBarHiding = map["enableUrlBarHiding"];
options.instantAppsEnabled = map["instantAppsEnabled"];
options.packageName = map["packageName"];
@@ -84,4 +85,4 @@ class AndroidChromeCustomTabsOptions
AndroidChromeCustomTabsOptions copy() {
return AndroidChromeCustomTabsOptions.fromMap(this.toMap());
}
-}
\ No newline at end of file
+}
diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart
index 601b0550..b6fc4780 100755
--- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart
+++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart
@@ -83,8 +83,7 @@ class ChromeSafariBrowser {
///
///[options]: Options for the [ChromeSafariBrowser].
Future open(
- {required Uri url,
- ChromeSafariBrowserClassOptions? options}) async {
+ {required Uri url, ChromeSafariBrowserClassOptions? options}) async {
assert(url.toString().isNotEmpty);
this.throwIsAlreadyOpened(message: 'Cannot open $url!');
diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser_options.dart b/lib/src/chrome_safari_browser/chrome_safari_browser_options.dart
index 8b8b91ca..ca432ec5 100755
--- a/lib/src/chrome_safari_browser/chrome_safari_browser_options.dart
+++ b/lib/src/chrome_safari_browser/chrome_safari_browser_options.dart
@@ -43,7 +43,8 @@ class ChromeSafariBrowserClassOptions {
Map options = {};
if (defaultTargetPlatform == TargetPlatform.android)
options.addAll(this.android?.toMap() ?? {});
- else if (defaultTargetPlatform == TargetPlatform.iOS) options.addAll(this.ios?.toMap() ?? {});
+ else if (defaultTargetPlatform == TargetPlatform.iOS)
+ options.addAll(this.ios?.toMap() ?? {});
return options;
}
@@ -56,4 +57,4 @@ class ChromeSafariBrowserClassOptions {
String toString() {
return toMap().toString();
}
-}
\ No newline at end of file
+}
diff --git a/lib/src/chrome_safari_browser/ios/main.dart b/lib/src/chrome_safari_browser/ios/main.dart
index 35573726..88c59931 100644
--- a/lib/src/chrome_safari_browser/ios/main.dart
+++ b/lib/src/chrome_safari_browser/ios/main.dart
@@ -1 +1 @@
-export 'safari_options.dart';
\ No newline at end of file
+export 'safari_options.dart';
diff --git a/lib/src/chrome_safari_browser/ios/safari_options.dart b/lib/src/chrome_safari_browser/ios/safari_options.dart
index 1eee87a9..b7a2c4a7 100755
--- a/lib/src/chrome_safari_browser/ios/safari_options.dart
+++ b/lib/src/chrome_safari_browser/ios/safari_options.dart
@@ -65,8 +65,10 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
options.barCollapsingEnabled = map["barCollapsingEnabled"];
options.dismissButtonStyle =
IOSSafariDismissButtonStyle.fromValue(map["dismissButtonStyle"])!;
- options.preferredBarTintColor = UtilColor.fromHex(map["preferredBarTintColor"]);
- options.preferredControlTintColor = UtilColor.fromHex(map["preferredControlTintColor"]);
+ options.preferredBarTintColor =
+ UtilColor.fromHex(map["preferredBarTintColor"]);
+ options.preferredControlTintColor =
+ UtilColor.fromHex(map["preferredControlTintColor"]);
options.presentationStyle =
IOSUIModalPresentationStyle.fromValue(map["presentationStyle"])!;
options.transitionStyle =
diff --git a/lib/src/chrome_safari_browser/main.dart b/lib/src/chrome_safari_browser/main.dart
index dfe4093e..1565ca1e 100644
--- a/lib/src/chrome_safari_browser/main.dart
+++ b/lib/src/chrome_safari_browser/main.dart
@@ -1,4 +1,4 @@
export 'chrome_safari_browser.dart';
export 'chrome_safari_browser_options.dart';
export 'android/main.dart';
-export 'ios/main.dart';
\ No newline at end of file
+export 'ios/main.dart';
diff --git a/lib/src/context_menu.dart b/lib/src/context_menu.dart
index aaadbfab..1ff12542 100644
--- a/lib/src/context_menu.dart
+++ b/lib/src/context_menu.dart
@@ -65,10 +65,7 @@ class ContextMenuItem {
Function()? action;
ContextMenuItem(
- {this.androidId,
- this.iosId,
- required this.title,
- this.action});
+ {this.androidId, this.iosId, required this.title, this.action});
Map toMap() {
return {"androidId": androidId, "iosId": iosId, "title": title};
diff --git a/lib/src/cookie_manager.dart b/lib/src/cookie_manager.dart
index 98191480..9b8c0b40 100755
--- a/lib/src/cookie_manager.dart
+++ b/lib/src/cookie_manager.dart
@@ -76,9 +76,17 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) {
- await _setCookieWithJavaScript(url: url, name: name, value: value, domain: domain,
- path: path, expiresDate: expiresDate, maxAge: maxAge, isSecure: isSecure,
- sameSite: sameSite, webViewController: iosBelow11WebViewController);
+ await _setCookieWithJavaScript(
+ url: url,
+ name: name,
+ value: value,
+ domain: domain,
+ path: path,
+ expiresDate: expiresDate,
+ maxAge: maxAge,
+ isSecure: isSecure,
+ sameSite: sameSite,
+ webViewController: iosBelow11WebViewController);
return;
}
}
@@ -100,35 +108,32 @@ class CookieManager {
Future _setCookieWithJavaScript(
{required Uri url,
- required String name,
- required String value,
- required String domain,
- String path = "/",
- int? expiresDate,
- int? maxAge,
- bool? isSecure,
- HTTPCookieSameSitePolicy? sameSite,
- InAppWebViewController? webViewController}) async {
- var cookieValue = name + "=" + value + "; Domain=" + domain + "; Path=" + path;
+ required String name,
+ required String value,
+ required String domain,
+ String path = "/",
+ int? expiresDate,
+ int? maxAge,
+ bool? isSecure,
+ HTTPCookieSameSitePolicy? sameSite,
+ InAppWebViewController? webViewController}) async {
+ var cookieValue =
+ name + "=" + value + "; Domain=" + domain + "; Path=" + path;
if (expiresDate != null)
cookieValue += "; Expires=" + _getCookieExpirationDate(expiresDate);
- if (maxAge != null)
- cookieValue += "; Max-Age=" + maxAge.toString();
+ if (maxAge != null) cookieValue += "; Max-Age=" + maxAge.toString();
- if (isSecure != null && isSecure)
- cookieValue += "; Secure";
+ if (isSecure != null && isSecure) cookieValue += "; Secure";
- if (sameSite != null)
- cookieValue += "; SameSite=" + sameSite.toValue();
+ if (sameSite != null) cookieValue += "; SameSite=" + sameSite.toValue();
cookieValue += ";";
if (webViewController != null) {
InAppWebViewGroupOptions? options = await webViewController.getOptions();
- if (options != null &&
- options.crossPlatform.javaScriptEnabled) {
+ if (options != null && options.crossPlatform.javaScriptEnabled) {
await webViewController.evaluateJavascript(
source: 'document.cookie="$cookieValue"');
return;
@@ -158,7 +163,9 @@ class CookieManager {
///**NOTE for iOS below 11.0**: All the cookies returned this way will have all the properties to `null` except for [Cookie.name] and [Cookie.value].
///If [iosBelow11WebViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!).
- Future> getCookies({required Uri url, InAppWebViewController? iosBelow11WebViewController}) async {
+ Future> getCookies(
+ {required Uri url,
+ InAppWebViewController? iosBelow11WebViewController}) async {
assert(url.toString().isNotEmpty);
if (Platform.isIOS) {
@@ -166,7 +173,8 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) {
- return await _getCookiesWithJavaScript(url: url, webViewController: iosBelow11WebViewController);
+ return await _getCookiesWithJavaScript(
+ url: url, webViewController: iosBelow11WebViewController);
}
}
@@ -185,8 +193,7 @@ class CookieManager {
expiresDate: cookieMap["expiresDate"],
isSessionOnly: cookieMap["isSessionOnly"],
domain: cookieMap["domain"],
- sameSite:
- HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
+ sameSite: HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
isSecure: cookieMap["isSecure"],
isHttpOnly: cookieMap["isHttpOnly"],
path: cookieMap["path"]));
@@ -194,24 +201,26 @@ class CookieManager {
return cookies;
}
- Future> _getCookiesWithJavaScript({required Uri url, InAppWebViewController? webViewController}) async {
+ Future> _getCookiesWithJavaScript(
+ {required Uri url, InAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty);
List cookies = [];
if (webViewController != null) {
InAppWebViewGroupOptions? options = await webViewController.getOptions();
- if (options != null &&
- options.crossPlatform.javaScriptEnabled) {
- List documentCookies = (await webViewController.evaluateJavascript(source: 'document.cookie') as String)
- .split(';').map((documentCookie) => documentCookie.trim()).toList();
+ if (options != null && options.crossPlatform.javaScriptEnabled) {
+ List documentCookies = (await webViewController
+ .evaluateJavascript(source: 'document.cookie') as String)
+ .split(';')
+ .map((documentCookie) => documentCookie.trim())
+ .toList();
documentCookies.forEach((documentCookie) {
List cookie = documentCookie.split('=');
cookies.add(Cookie(
name: cookie[0],
value: cookie[1],
- )
- );
+ ));
});
return cookies;
}
@@ -227,15 +236,17 @@ class CookieManager {
await headlessWebView.run();
await pageLoaded.future;
- List documentCookies = (await headlessWebView.webViewController.evaluateJavascript(source: 'document.cookie') as String)
- .split(';').map((documentCookie) => documentCookie.trim()).toList();
+ List documentCookies = (await headlessWebView.webViewController
+ .evaluateJavascript(source: 'document.cookie') as String)
+ .split(';')
+ .map((documentCookie) => documentCookie.trim())
+ .toList();
documentCookies.forEach((documentCookie) {
List cookie = documentCookie.split('=');
cookies.add(Cookie(
name: cookie[0],
value: cookie[1],
- )
- );
+ ));
});
await headlessWebView.dispose();
return cookies;
@@ -251,8 +262,9 @@ class CookieManager {
///If [iosBelow11WebViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!).
Future getCookie(
- {required Uri url, required String name, InAppWebViewController? iosBelow11WebViewController}) async {
-
+ {required Uri url,
+ required String name,
+ InAppWebViewController? iosBelow11WebViewController}) async {
assert(url.toString().isNotEmpty);
assert(name.isNotEmpty);
@@ -261,8 +273,11 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) {
- List cookies = await _getCookiesWithJavaScript(url: url, webViewController: iosBelow11WebViewController);
- return cookies.cast().firstWhere((cookie) => cookie!.name == name, orElse: () => null);
+ List cookies = await _getCookiesWithJavaScript(
+ url: url, webViewController: iosBelow11WebViewController);
+ return cookies
+ .cast()
+ .firstWhere((cookie) => cookie!.name == name, orElse: () => null);
}
}
@@ -315,7 +330,14 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) {
- await _setCookieWithJavaScript(url: url, name: name, value: "", path: path, domain: domain, maxAge: -1, webViewController: iosBelow11WebViewController);
+ await _setCookieWithJavaScript(
+ url: url,
+ name: name,
+ value: "",
+ path: path,
+ domain: domain,
+ maxAge: -1,
+ webViewController: iosBelow11WebViewController);
return;
}
}
@@ -340,8 +362,10 @@ class CookieManager {
///**NOTE for iOS below 11.0**: If [iosBelow11WebViewController] is `null` or JavaScript is disabled for it, it will try to use a [HeadlessInAppWebView]
///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!).
Future deleteCookies(
- {required Uri url, String domain = "", String path = "/",
- InAppWebViewController? iosBelow11WebViewController}) async {
+ {required Uri url,
+ String domain = "",
+ String path = "/",
+ InAppWebViewController? iosBelow11WebViewController}) async {
if (domain.isEmpty) domain = _getDomainName(url);
assert(url.toString().isNotEmpty);
@@ -351,9 +375,17 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) {
- List cookies = await _getCookiesWithJavaScript(url: url, webViewController: iosBelow11WebViewController);
+ List cookies = await _getCookiesWithJavaScript(
+ url: url, webViewController: iosBelow11WebViewController);
for (var i = 0; i < cookies.length; i++) {
- await _setCookieWithJavaScript(url: url, name: cookies[i].name, value: "", path: path, domain: domain, maxAge: -1, webViewController: iosBelow11WebViewController);
+ await _setCookieWithJavaScript(
+ url: url,
+ name: cookies[i].name,
+ value: "",
+ path: path,
+ domain: domain,
+ maxAge: -1,
+ webViewController: iosBelow11WebViewController);
}
return;
}
@@ -383,7 +415,8 @@ class CookieManager {
String _getCookieExpirationDate(int expiresDate) {
var dateTime = DateTime.fromMillisecondsSinceEpoch(expiresDate).toUtc();
- return DateFormat('EEE, d MMM yyyy hh:mm:ss', "en_US").format(dateTime) + ' GMT';
+ return DateFormat('EEE, d MMM yyyy hh:mm:ss', "en_US").format(dateTime) +
+ ' GMT';
}
}
@@ -411,7 +444,7 @@ class IOSCookieManager {
Map args = {};
List cookieListMap =
- await CookieManager._channel.invokeMethod('getAllCookies', args);
+ await CookieManager._channel.invokeMethod('getAllCookies', args);
cookieListMap = cookieListMap.cast