code format

This commit is contained in:
Lorenzo Pichilli 2021-02-22 23:54:09 +01:00
parent f886f2f1e5
commit 68f98754df
57 changed files with 1262 additions and 1665 deletions

View File

@ -1,772 +0,0 @@
<component name="libraryTable">
<library name="Dart Packages" type="DartPackagesLibraryType">
<properties>
<option name="packageNameToDirsMap">
<entry key="_fe_analyzer_shared">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-12.0.0/lib" />
</list>
</value>
</entry>
<entry key="analyzer">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.6/lib" />
</list>
</value>
</entry>
<entry key="archive">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.0.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib" />
</list>
</value>
</entry>
<entry key="args">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib" />
</list>
</value>
</entry>
<entry key="async">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.5.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.5.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="boolean_selector">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="characters">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0-nullsafety.5/lib" />
</list>
</value>
</entry>
<entry key="charcode">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="cli_util">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/cli_util-0.2.0/lib" />
</list>
</value>
</entry>
<entry key="clock">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="collection">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0-nullsafety.5/lib" />
</list>
</value>
</entry>
<entry key="convert">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
</list>
</value>
</entry>
<entry key="coverage">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/coverage-0.14.2/lib" />
</list>
</value>
</entry>
<entry key="crypto">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-3.0.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.5/lib" />
</list>
</value>
</entry>
<entry key="cupertino_icons">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.2/lib" />
</list>
</value>
</entry>
<entry key="device_info">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/lib" />
</list>
</value>
</entry>
<entry key="device_info_platform_interface">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/device_info_platform_interface-2.0.0-nullsafety.2/lib" />
</list>
</value>
</entry>
<entry key="fake_async">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="ffi">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-1.0.0/lib" />
</list>
</value>
</entry>
<entry key="file">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/file-6.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/file-6.0.0-nullsafety.4/lib" />
</list>
</value>
</entry>
<entry key="flutter">
<value>
<list>
<option value="$USER_HOME$/flutter/packages/flutter/lib" />
</list>
</value>
</entry>
<entry key="flutter_downloader">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/lib" />
</list>
</value>
</entry>
<entry key="flutter_driver">
<value>
<list>
<option value="$USER_HOME$/flutter/packages/flutter_driver/lib" />
</list>
</value>
</entry>
<entry key="flutter_test">
<value>
<list>
<option value="$USER_HOME$/flutter/packages/flutter_test/lib" />
</list>
</value>
</entry>
<entry key="fuchsia_remote_debug_protocol">
<value>
<list>
<option value="$USER_HOME$/flutter/packages/fuchsia_remote_debug_protocol/lib" />
</list>
</value>
</entry>
<entry key="glob">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.2.0/lib" />
</list>
</value>
</entry>
<entry key="http_multi_server">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.2.0/lib" />
</list>
</value>
</entry>
<entry key="http_parser">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib" />
</list>
</value>
</entry>
<entry key="integration_test">
<value>
<list>
<option value="$USER_HOME$/flutter/packages/integration_test/lib" />
</list>
</value>
</entry>
<entry key="intl">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib" />
</list>
</value>
</entry>
<entry key="io">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.4/lib" />
</list>
</value>
</entry>
<entry key="js">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="json_rpc_2">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.2.2/lib" />
</list>
</value>
</entry>
<entry key="logging">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.4/lib" />
</list>
</value>
</entry>
<entry key="matcher">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="meta">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.6/lib" />
</list>
</value>
</entry>
<entry key="mime">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mime-1.0.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.7/lib" />
</list>
</value>
</entry>
<entry key="mockito">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-4.1.1/lib" />
</list>
</value>
</entry>
<entry key="node_interop">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_interop-1.2.1/lib" />
</list>
</value>
</entry>
<entry key="node_io">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_io-1.1.1/lib" />
</list>
</value>
</entry>
<entry key="node_preamble">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.13/lib" />
</list>
</value>
</entry>
<entry key="package_config">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.9.3/lib" />
</list>
</value>
</entry>
<entry key="path">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="path_provider">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/lib" />
</list>
</value>
</entry>
<entry key="path_provider_linux">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/lib" />
</list>
</value>
</entry>
<entry key="path_provider_macos">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/lib" />
</list>
</value>
</entry>
<entry key="path_provider_platform_interface">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_platform_interface-2.0.0-nullsafety/lib" />
</list>
</value>
</entry>
<entry key="path_provider_windows">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="pedantic">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.10.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.10.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="permission_handler">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/lib" />
</list>
</value>
</entry>
<entry key="permission_handler_platform_interface">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler_platform_interface-2.0.2/lib" />
</list>
</value>
</entry>
<entry key="platform">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0-nullsafety.4/lib" />
</list>
</value>
</entry>
<entry key="plugin_platform_interface">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/plugin_platform_interface-1.1.0-nullsafety.1/lib" />
</list>
</value>
</entry>
<entry key="pool">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.5.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="process">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.0.0-nullsafety.4/lib" />
</list>
</value>
</entry>
<entry key="pub_semver">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.4/lib" />
</list>
</value>
</entry>
<entry key="shelf">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.5/lib" />
</list>
</value>
</entry>
<entry key="shelf_packages_handler">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-2.0.0/lib" />
</list>
</value>
</entry>
<entry key="shelf_static">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.9+1/lib" />
</list>
</value>
</entry>
<entry key="shelf_web_socket">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib" />
</list>
</value>
</entry>
<entry key="sky_engine">
<value>
<list>
<option value="$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib" />
</list>
</value>
</entry>
<entry key="source_map_stack_trace">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-2.1.0-nullsafety.4/lib" />
</list>
</value>
</entry>
<entry key="source_maps">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.10-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="source_span">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.0-nullsafety.4/lib" />
</list>
</value>
</entry>
<entry key="stack_trace">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0-nullsafety.6/lib" />
</list>
</value>
</entry>
<entry key="stream_channel">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="string_scanner">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="sync_http">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/sync_http-0.3.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/sync_http-0.2.0/lib" />
</list>
</value>
</entry>
<entry key="term_glyph">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="test">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.16.0-nullsafety.9/lib" />
</list>
</value>
</entry>
<entry key="test_api">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19-nullsafety.6/lib" />
</list>
</value>
</entry>
<entry key="test_core">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_core-0.3.12-nullsafety.9/lib" />
</list>
</value>
</entry>
<entry key="typed_data">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0-nullsafety.5/lib" />
</list>
</value>
</entry>
<entry key="url_launcher">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/lib" />
</list>
</value>
</entry>
<entry key="url_launcher_linux">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/lib" />
</list>
</value>
</entry>
<entry key="url_launcher_macos">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/lib" />
</list>
</value>
</entry>
<entry key="url_launcher_platform_interface">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-2.0.0-nullsafety.1/lib" />
</list>
</value>
</entry>
<entry key="url_launcher_windows">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/lib" />
</list>
</value>
</entry>
<entry key="uuid">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/uuid-3.0.0-nullsafety.0/lib" />
</list>
</value>
</entry>
<entry key="vector_math">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0-nullsafety.5/lib" />
</list>
</value>
</entry>
<entry key="vm_service">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service-6.0.1-nullsafety.1/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service-5.5.0/lib" />
</list>
</value>
</entry>
<entry key="watcher">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+15/lib" />
</list>
</value>
</entry>
<entry key="web_socket_channel">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.2.0/lib" />
</list>
</value>
</entry>
<entry key="webdriver">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webdriver-3.0.0/lib" />
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webdriver-2.1.2/lib" />
</list>
</value>
</entry>
<entry key="webkit_inspection_protocol">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webkit_inspection_protocol-0.7.4/lib" />
</list>
</value>
</entry>
<entry key="win32">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.0.0/lib" />
</list>
</value>
</entry>
<entry key="xdg_directories">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/xdg_directories-0.2.0-nullsafety.1/lib" />
</list>
</value>
</entry>
<entry key="yaml">
<value>
<list>
<option value="$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib" />
</list>
</value>
</entry>
</option>
</properties>
<CLASSES>
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-12.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.40.6/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/archive-2.0.13/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.6.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.5.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.5.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/boolean_selector-2.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0-nullsafety.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/characters-1.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/charcode-1.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/cli_util-0.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/clock-1.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0-nullsafety.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/collection-1.15.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/convert-2.1.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/coverage-0.14.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-2.1.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/crypto-3.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-1.0.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/device_info_platform_interface-2.0.0-nullsafety.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/fake_async-1.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-1.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/file-6.0.0-nullsafety.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/file-6.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.5.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/glob-1.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/http_parser-3.1.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/intl-0.17.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/io-0.3.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/js-0.6.3-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/json_rpc_2-2.2.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/logging-0.11.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/matcher-0.12.10/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0-nullsafety.6/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/meta-1.3.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mime-0.9.7/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mime-1.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/mockito-4.1.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_interop-1.2.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_io-1.1.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/node_preamble-1.4.13/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/package_config-1.9.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path-1.8.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-2.0.0-nullsafety/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-0.2.0-nullsafety/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.5-nullsafety/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_platform_interface-2.0.0-nullsafety/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.10.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pedantic-1.10.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.1.0+2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler_platform_interface-2.0.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0-nullsafety.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/platform-3.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/plugin_platform_interface-1.1.0-nullsafety.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pool-1.5.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.0.0-nullsafety.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/process-4.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/pub_semver-1.4.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf-0.7.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_packages_handler-2.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_static-0.2.9+1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/shelf_web_socket-0.2.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_map_stack_trace-2.1.0-nullsafety.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_maps-0.10.10-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.0-nullsafety.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/source_span-1.8.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0-nullsafety.6/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stack_trace-1.10.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/stream_channel-2.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/string_scanner-1.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/sync_http-0.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/sync_http-0.3.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/term_glyph-1.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test-1.16.0-nullsafety.9/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19-nullsafety.6/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_api-0.2.19/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/test_core-0.3.12-nullsafety.9/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0-nullsafety.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/typed_data-1.3.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher-6.0.0-nullsafety.6/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_linux-0.1.0-nullsafety.3/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_macos-0.1.0-nullsafety.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_platform_interface-2.0.0-nullsafety.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/url_launcher_windows-0.1.0-nullsafety.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/uuid-3.0.0-nullsafety.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0-nullsafety.5/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vector_math-2.1.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service-5.5.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/vm_service-6.0.1-nullsafety.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/watcher-0.9.7+15/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/web_socket_channel-1.2.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webdriver-2.1.2/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webdriver-3.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/webkit_inspection_protocol-0.7.4/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/win32-2.0.0/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/xdg_directories-0.2.0-nullsafety.1/lib" />
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/yaml-2.2.1/lib" />
<root url="file://$USER_HOME$/flutter/bin/cache/pkg/sky_engine/lib" />
<root url="file://$USER_HOME$/flutter/packages/flutter/lib" />
<root url="file://$USER_HOME$/flutter/packages/flutter_driver/lib" />
<root url="file://$USER_HOME$/flutter/packages/flutter_test/lib" />
<root url="file://$USER_HOME$/flutter/packages/fuchsia_remote_debug_protocol/lib" />
<root url="file://$USER_HOME$/flutter/packages/integration_test/lib" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,6 +1,9 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="Flutter Plugins"> <library name="Flutter Plugins">
<CLASSES /> <CLASSES>
<root url="file://$USER_HOME$/flutter/.pub-cache/hosted/pub.dartlang.org/device_info-2.0.0-nullsafety.2" />
<root url="file://$PROJECT_DIR$" />
</CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />
</library> </library>

View File

@ -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"} {"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"}

View File

@ -2,12 +2,12 @@
# This is a generated file; do not edit or check into version control. # This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/lorenzopichilli/flutter" export "FLUTTER_ROOT=/Users/lorenzopichilli/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example" 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 "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios" export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1" export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==" export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false" export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true" export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false" export "TREE_SHAKE_ICONS=false"

View File

@ -80,6 +80,5 @@
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" /> <orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" /> <orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component> </component>
</module> </module>

View File

@ -21,4 +21,4 @@
library flutter_inappwebview; library flutter_inappwebview;
export 'src/main.dart'; export 'src/main.dart';

View File

@ -1,3 +1,3 @@
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
final UUID_GENERATOR = Uuid(); final UUID_GENERATOR = Uuid();

View File

@ -27,17 +27,21 @@ class AndroidServiceWorkerController {
} }
static Future<dynamic> _handleMethod(MethodCall call) async { static Future<dynamic> _handleMethod(MethodCall call) async {
AndroidServiceWorkerController controller = AndroidServiceWorkerController.instance(); AndroidServiceWorkerController controller =
AndroidServiceWorkerClient? serviceWorkerClient = controller.serviceWorkerClient; AndroidServiceWorkerController.instance();
AndroidServiceWorkerClient? serviceWorkerClient =
controller.serviceWorkerClient;
switch (call.method) { switch (call.method) {
case "shouldInterceptRequest": case "shouldInterceptRequest":
if (serviceWorkerClient != null && serviceWorkerClient.shouldInterceptRequest != null) { if (serviceWorkerClient != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); serviceWorkerClient.shouldInterceptRequest != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
WebResourceRequest request = WebResourceRequest.fromMap(arguments)!; WebResourceRequest request = WebResourceRequest.fromMap(arguments)!;
return (await serviceWorkerClient.shouldInterceptRequest!(request)) return (await serviceWorkerClient.shouldInterceptRequest!(request))
?.toMap(); ?.toMap();
} }
break; break;
default: default:
@ -88,7 +92,8 @@ class AndroidServiceWorkerController {
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getCacheMode() ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerWebSettingsCompat#getCacheMode()
static Future<AndroidCacheMode?> getCacheMode() async { static Future<AndroidCacheMode?> getCacheMode() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
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. ///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 ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/ServiceWorkerClientCompat
class AndroidServiceWorkerClient { class AndroidServiceWorkerClient {
///Notify the host application of a resource request and allow the application to return the data. ///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. ///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. ///Otherwise, the return response and data will be used.
@ -158,9 +162,7 @@ class AndroidServiceWorkerClient {
/// ///
///**NOTE**: available on Android 24+. ///**NOTE**: available on Android 24+.
final Future<WebResourceResponse?> Function(WebResourceRequest request)? final Future<WebResourceResponse?> Function(WebResourceRequest request)?
shouldInterceptRequest; shouldInterceptRequest;
AndroidServiceWorkerClient({ AndroidServiceWorkerClient({this.shouldInterceptRequest});
this.shouldInterceptRequest }
});
}

View File

@ -59,8 +59,8 @@ class AndroidWebViewFeature {
static AndroidWebViewFeature? fromValue(String? value) { static AndroidWebViewFeature? fromValue(String? value) {
if (value != null) { if (value != null) {
try { try {
return AndroidWebViewFeature.values.firstWhere( return AndroidWebViewFeature.values
(element) => element.toValue() == value); .firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; return null;
} }
@ -74,127 +74,174 @@ class AndroidWebViewFeature {
String toString() => _value; 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 = 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; bool operator ==(value) => value == _value;
@ -211,4 +258,4 @@ class AndroidWebViewFeature {
args.putIfAbsent("feature", () => feature.toValue()); args.putIfAbsent("feature", () => feature.toValue());
return await _channel.invokeMethod('isFeatureSupported', args); return await _channel.invokeMethod('isFeatureSupported', args);
} }
} }

View File

@ -62,7 +62,8 @@ class AndroidChromeCustomTabsOptions
new AndroidChromeCustomTabsOptions(); new AndroidChromeCustomTabsOptions();
options.addDefaultShareMenuItem = map["addDefaultShareMenuItem"]; options.addDefaultShareMenuItem = map["addDefaultShareMenuItem"];
options.showTitle = map["showTitle"]; options.showTitle = map["showTitle"];
options.toolbarBackgroundColor = UtilColor.fromHex(map["toolbarBackgroundColor"]); options.toolbarBackgroundColor =
UtilColor.fromHex(map["toolbarBackgroundColor"]);
options.enableUrlBarHiding = map["enableUrlBarHiding"]; options.enableUrlBarHiding = map["enableUrlBarHiding"];
options.instantAppsEnabled = map["instantAppsEnabled"]; options.instantAppsEnabled = map["instantAppsEnabled"];
options.packageName = map["packageName"]; options.packageName = map["packageName"];
@ -84,4 +85,4 @@ class AndroidChromeCustomTabsOptions
AndroidChromeCustomTabsOptions copy() { AndroidChromeCustomTabsOptions copy() {
return AndroidChromeCustomTabsOptions.fromMap(this.toMap()); return AndroidChromeCustomTabsOptions.fromMap(this.toMap());
} }
} }

View File

@ -83,8 +83,7 @@ class ChromeSafariBrowser {
/// ///
///[options]: Options for the [ChromeSafariBrowser]. ///[options]: Options for the [ChromeSafariBrowser].
Future<void> open( Future<void> open(
{required Uri url, {required Uri url, ChromeSafariBrowserClassOptions? options}) async {
ChromeSafariBrowserClassOptions? options}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
this.throwIsAlreadyOpened(message: 'Cannot open $url!'); this.throwIsAlreadyOpened(message: 'Cannot open $url!');

View File

@ -43,7 +43,8 @@ class ChromeSafariBrowserClassOptions {
Map<String, dynamic> options = {}; Map<String, dynamic> options = {};
if (defaultTargetPlatform == TargetPlatform.android) if (defaultTargetPlatform == TargetPlatform.android)
options.addAll(this.android?.toMap() ?? {}); 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; return options;
} }
@ -56,4 +57,4 @@ class ChromeSafariBrowserClassOptions {
String toString() { String toString() {
return toMap().toString(); return toMap().toString();
} }
} }

View File

@ -1 +1 @@
export 'safari_options.dart'; export 'safari_options.dart';

View File

@ -65,8 +65,10 @@ class IOSSafariOptions implements ChromeSafariBrowserOptions, IosOptions {
options.barCollapsingEnabled = map["barCollapsingEnabled"]; options.barCollapsingEnabled = map["barCollapsingEnabled"];
options.dismissButtonStyle = options.dismissButtonStyle =
IOSSafariDismissButtonStyle.fromValue(map["dismissButtonStyle"])!; IOSSafariDismissButtonStyle.fromValue(map["dismissButtonStyle"])!;
options.preferredBarTintColor = UtilColor.fromHex(map["preferredBarTintColor"]); options.preferredBarTintColor =
options.preferredControlTintColor = UtilColor.fromHex(map["preferredControlTintColor"]); UtilColor.fromHex(map["preferredBarTintColor"]);
options.preferredControlTintColor =
UtilColor.fromHex(map["preferredControlTintColor"]);
options.presentationStyle = options.presentationStyle =
IOSUIModalPresentationStyle.fromValue(map["presentationStyle"])!; IOSUIModalPresentationStyle.fromValue(map["presentationStyle"])!;
options.transitionStyle = options.transitionStyle =

View File

@ -1,4 +1,4 @@
export 'chrome_safari_browser.dart'; export 'chrome_safari_browser.dart';
export 'chrome_safari_browser_options.dart'; export 'chrome_safari_browser_options.dart';
export 'android/main.dart'; export 'android/main.dart';
export 'ios/main.dart'; export 'ios/main.dart';

View File

@ -65,10 +65,7 @@ class ContextMenuItem {
Function()? action; Function()? action;
ContextMenuItem( ContextMenuItem(
{this.androidId, {this.androidId, this.iosId, required this.title, this.action});
this.iosId,
required this.title,
this.action});
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
return {"androidId": androidId, "iosId": iosId, "title": title}; return {"androidId": androidId, "iosId": iosId, "title": title};

View File

@ -76,9 +76,17 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion); var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) { if (version != null && version < 11.0) {
await _setCookieWithJavaScript(url: url, name: name, value: value, domain: domain, await _setCookieWithJavaScript(
path: path, expiresDate: expiresDate, maxAge: maxAge, isSecure: isSecure, url: url,
sameSite: sameSite, webViewController: iosBelow11WebViewController); name: name,
value: value,
domain: domain,
path: path,
expiresDate: expiresDate,
maxAge: maxAge,
isSecure: isSecure,
sameSite: sameSite,
webViewController: iosBelow11WebViewController);
return; return;
} }
} }
@ -100,35 +108,32 @@ class CookieManager {
Future<void> _setCookieWithJavaScript( Future<void> _setCookieWithJavaScript(
{required Uri url, {required Uri url,
required String name, required String name,
required String value, required String value,
required String domain, required String domain,
String path = "/", String path = "/",
int? expiresDate, int? expiresDate,
int? maxAge, int? maxAge,
bool? isSecure, bool? isSecure,
HTTPCookieSameSitePolicy? sameSite, HTTPCookieSameSitePolicy? sameSite,
InAppWebViewController? webViewController}) async { InAppWebViewController? webViewController}) async {
var cookieValue = name + "=" + value + "; Domain=" + domain + "; Path=" + path; var cookieValue =
name + "=" + value + "; Domain=" + domain + "; Path=" + path;
if (expiresDate != null) if (expiresDate != null)
cookieValue += "; Expires=" + _getCookieExpirationDate(expiresDate); cookieValue += "; Expires=" + _getCookieExpirationDate(expiresDate);
if (maxAge != null) if (maxAge != null) cookieValue += "; Max-Age=" + maxAge.toString();
cookieValue += "; Max-Age=" + maxAge.toString();
if (isSecure != null && isSecure) if (isSecure != null && isSecure) cookieValue += "; Secure";
cookieValue += "; Secure";
if (sameSite != null) if (sameSite != null) cookieValue += "; SameSite=" + sameSite.toValue();
cookieValue += "; SameSite=" + sameSite.toValue();
cookieValue += ";"; cookieValue += ";";
if (webViewController != null) { if (webViewController != null) {
InAppWebViewGroupOptions? options = await webViewController.getOptions(); InAppWebViewGroupOptions? options = await webViewController.getOptions();
if (options != null && if (options != null && options.crossPlatform.javaScriptEnabled) {
options.crossPlatform.javaScriptEnabled) {
await webViewController.evaluateJavascript( await webViewController.evaluateJavascript(
source: 'document.cookie="$cookieValue"'); source: 'document.cookie="$cookieValue"');
return; 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]. ///**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] ///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!). ///to get the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be found!).
Future<List<Cookie>> getCookies({required Uri url, InAppWebViewController? iosBelow11WebViewController}) async { Future<List<Cookie>> getCookies(
{required Uri url,
InAppWebViewController? iosBelow11WebViewController}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
if (Platform.isIOS) { if (Platform.isIOS) {
@ -166,7 +173,8 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion); var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) { 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"], expiresDate: cookieMap["expiresDate"],
isSessionOnly: cookieMap["isSessionOnly"], isSessionOnly: cookieMap["isSessionOnly"],
domain: cookieMap["domain"], domain: cookieMap["domain"],
sameSite: sameSite: HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
isSecure: cookieMap["isSecure"], isSecure: cookieMap["isSecure"],
isHttpOnly: cookieMap["isHttpOnly"], isHttpOnly: cookieMap["isHttpOnly"],
path: cookieMap["path"])); path: cookieMap["path"]));
@ -194,24 +201,26 @@ class CookieManager {
return cookies; return cookies;
} }
Future<List<Cookie>> _getCookiesWithJavaScript({required Uri url, InAppWebViewController? webViewController}) async { Future<List<Cookie>> _getCookiesWithJavaScript(
{required Uri url, InAppWebViewController? webViewController}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
List<Cookie> cookies = []; List<Cookie> cookies = [];
if (webViewController != null) { if (webViewController != null) {
InAppWebViewGroupOptions? options = await webViewController.getOptions(); InAppWebViewGroupOptions? options = await webViewController.getOptions();
if (options != null && if (options != null && options.crossPlatform.javaScriptEnabled) {
options.crossPlatform.javaScriptEnabled) { List<String> documentCookies = (await webViewController
List<String> documentCookies = (await webViewController.evaluateJavascript(source: 'document.cookie') as String) .evaluateJavascript(source: 'document.cookie') as String)
.split(';').map((documentCookie) => documentCookie.trim()).toList(); .split(';')
.map((documentCookie) => documentCookie.trim())
.toList();
documentCookies.forEach((documentCookie) { documentCookies.forEach((documentCookie) {
List<String> cookie = documentCookie.split('='); List<String> cookie = documentCookie.split('=');
cookies.add(Cookie( cookies.add(Cookie(
name: cookie[0], name: cookie[0],
value: cookie[1], value: cookie[1],
) ));
);
}); });
return cookies; return cookies;
} }
@ -227,15 +236,17 @@ class CookieManager {
await headlessWebView.run(); await headlessWebView.run();
await pageLoaded.future; await pageLoaded.future;
List<String> documentCookies = (await headlessWebView.webViewController.evaluateJavascript(source: 'document.cookie') as String) List<String> documentCookies = (await headlessWebView.webViewController
.split(';').map((documentCookie) => documentCookie.trim()).toList(); .evaluateJavascript(source: 'document.cookie') as String)
.split(';')
.map((documentCookie) => documentCookie.trim())
.toList();
documentCookies.forEach((documentCookie) { documentCookies.forEach((documentCookie) {
List<String> cookie = documentCookie.split('='); List<String> cookie = documentCookie.split('=');
cookies.add(Cookie( cookies.add(Cookie(
name: cookie[0], name: cookie[0],
value: cookie[1], value: cookie[1],
) ));
);
}); });
await headlessWebView.dispose(); await headlessWebView.dispose();
return cookies; 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] ///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!). ///to get the cookie (session-only cookie and cookie with `isHttpOnly` enabled won't be found!).
Future<Cookie?> getCookie( Future<Cookie?> getCookie(
{required Uri url, required String name, InAppWebViewController? iosBelow11WebViewController}) async { {required Uri url,
required String name,
InAppWebViewController? iosBelow11WebViewController}) async {
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
assert(name.isNotEmpty); assert(name.isNotEmpty);
@ -261,8 +273,11 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion); var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) { if (version != null && version < 11.0) {
List<Cookie> cookies = await _getCookiesWithJavaScript(url: url, webViewController: iosBelow11WebViewController); List<Cookie> cookies = await _getCookiesWithJavaScript(
return cookies.cast<Cookie?>().firstWhere((cookie) => cookie!.name == name, orElse: () => null); url: url, webViewController: iosBelow11WebViewController);
return cookies
.cast<Cookie?>()
.firstWhere((cookie) => cookie!.name == name, orElse: () => null);
} }
} }
@ -315,7 +330,14 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion); var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) { 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; 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] ///**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!). ///to delete the cookies (session-only cookies and cookies with `isHttpOnly` enabled won't be deleted!).
Future<void> deleteCookies( Future<void> deleteCookies(
{required Uri url, String domain = "", String path = "/", {required Uri url,
InAppWebViewController? iosBelow11WebViewController}) async { String domain = "",
String path = "/",
InAppWebViewController? iosBelow11WebViewController}) async {
if (domain.isEmpty) domain = _getDomainName(url); if (domain.isEmpty) domain = _getDomainName(url);
assert(url.toString().isNotEmpty); assert(url.toString().isNotEmpty);
@ -351,9 +375,17 @@ class CookieManager {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo; IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
var version = double.tryParse(iosInfo.systemVersion); var version = double.tryParse(iosInfo.systemVersion);
if (version != null && version < 11.0) { if (version != null && version < 11.0) {
List<Cookie> cookies = await _getCookiesWithJavaScript(url: url, webViewController: iosBelow11WebViewController); List<Cookie> cookies = await _getCookiesWithJavaScript(
url: url, webViewController: iosBelow11WebViewController);
for (var i = 0; i < cookies.length; i++) { 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; return;
} }
@ -383,7 +415,8 @@ class CookieManager {
String _getCookieExpirationDate(int expiresDate) { String _getCookieExpirationDate(int expiresDate) {
var dateTime = DateTime.fromMillisecondsSinceEpoch(expiresDate).toUtc(); 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<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
List<dynamic> cookieListMap = List<dynamic> cookieListMap =
await CookieManager._channel.invokeMethod('getAllCookies', args); await CookieManager._channel.invokeMethod('getAllCookies', args);
cookieListMap = cookieListMap.cast<Map<dynamic, dynamic>>(); cookieListMap = cookieListMap.cast<Map<dynamic, dynamic>>();
cookieListMap.forEach((cookieMap) { cookieListMap.forEach((cookieMap) {
@ -421,12 +454,11 @@ class IOSCookieManager {
expiresDate: cookieMap["expiresDate"], expiresDate: cookieMap["expiresDate"],
isSessionOnly: cookieMap["isSessionOnly"], isSessionOnly: cookieMap["isSessionOnly"],
domain: cookieMap["domain"], domain: cookieMap["domain"],
sameSite: sameSite: HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
HTTPCookieSameSitePolicy.fromValue(cookieMap["sameSite"]),
isSecure: cookieMap["isSecure"], isSecure: cookieMap["isSecure"],
isHttpOnly: cookieMap["isHttpOnly"], isHttpOnly: cookieMap["isHttpOnly"],
path: cookieMap["path"])); path: cookieMap["path"]));
}); });
return cookies; return cookies;
} }
} }

View File

@ -38,7 +38,8 @@ class HttpAuthCredentialDatabase {
List<URLProtectionSpaceHttpAuthCredentials> result = []; List<URLProtectionSpaceHttpAuthCredentials> result = [];
for (Map<dynamic, dynamic> map in allCredentials) { for (Map<dynamic, dynamic> map in allCredentials) {
var element = URLProtectionSpaceHttpAuthCredentials.fromMap(map.cast<String, dynamic>()); var element = URLProtectionSpaceHttpAuthCredentials.fromMap(
map.cast<String, dynamic>());
if (element != null) { if (element != null) {
result.add(element); result.add(element);
} }

View File

@ -50,4 +50,4 @@ class AndroidInAppBrowserOptions implements BrowserOptions, AndroidOptions {
AndroidInAppBrowserOptions copy() { AndroidInAppBrowserOptions copy() {
return AndroidInAppBrowserOptions.fromMap(this.toMap()); return AndroidInAppBrowserOptions.fromMap(this.toMap());
} }
} }

View File

@ -1 +1 @@
export 'in_app_browser_options.dart'; export 'in_app_browser_options.dart';

View File

@ -67,8 +67,8 @@ class InAppBrowser {
MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$uuid'); MethodChannel('com.pichillilorenzo/flutter_inappbrowser_$uuid');
this._channel.setMethodCallHandler(handleMethod); this._channel.setMethodCallHandler(handleMethod);
_isOpened = false; _isOpened = false;
webViewController = webViewController = new InAppWebViewController.fromInAppBrowser(
new InAppWebViewController.fromInAppBrowser(uuid, this._channel, this, this.initialUserScripts); uuid, this._channel, this, this.initialUserScripts);
} }
Future<dynamic> handleMethod(MethodCall call) async { Future<dynamic> handleMethod(MethodCall call) async {
@ -100,10 +100,12 @@ class InAppBrowser {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('uuid', () => uuid); args.putIfAbsent('uuid', () => uuid);
args.putIfAbsent('urlRequest', () => urlRequest.toMap()); args.putIfAbsent('urlRequest', () => urlRequest.toMap());
args.putIfAbsent('options', () => options?.toMap() ?? InAppBrowserClassOptions().toMap()); args.putIfAbsent('options',
() => options?.toMap() ?? InAppBrowserClassOptions().toMap());
args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {}); args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {});
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
await _sharedChannel.invokeMethod('openUrlRequest', args); await _sharedChannel.invokeMethod('openUrlRequest', args);
} }
@ -151,10 +153,12 @@ class InAppBrowser {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('uuid', () => uuid); args.putIfAbsent('uuid', () => uuid);
args.putIfAbsent('assetFilePath', () => assetFilePath); args.putIfAbsent('assetFilePath', () => assetFilePath);
args.putIfAbsent('options', () => options?.toMap() ?? InAppBrowserClassOptions().toMap()); args.putIfAbsent('options',
() => options?.toMap() ?? InAppBrowserClassOptions().toMap());
args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {}); args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {});
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
await _sharedChannel.invokeMethod('openFile', args); await _sharedChannel.invokeMethod('openFile', args);
} }
@ -175,18 +179,21 @@ class InAppBrowser {
Uri? androidHistoryUrl, Uri? androidHistoryUrl,
InAppBrowserClassOptions? options}) async { InAppBrowserClassOptions? options}) async {
this.throwIfAlreadyOpened(message: 'Cannot open data!'); this.throwIfAlreadyOpened(message: 'Cannot open data!');
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('uuid', () => uuid); args.putIfAbsent('uuid', () => uuid);
args.putIfAbsent('options', () => options?.toMap() ?? InAppBrowserClassOptions().toMap()); args.putIfAbsent('options',
() => options?.toMap() ?? InAppBrowserClassOptions().toMap());
args.putIfAbsent('data', () => data); args.putIfAbsent('data', () => data);
args.putIfAbsent('mimeType', () => mimeType); args.putIfAbsent('mimeType', () => mimeType);
args.putIfAbsent('encoding', () => encoding); args.putIfAbsent('encoding', () => encoding);
args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank"); args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank");
args.putIfAbsent('historyUrl', () => androidHistoryUrl?.toString() ?? "about:blank"); args.putIfAbsent(
'historyUrl', () => androidHistoryUrl?.toString() ?? "about:blank");
args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {}); args.putIfAbsent('contextMenu', () => contextMenu?.toMap() ?? {});
args.putIfAbsent('windowId', () => windowId); args.putIfAbsent('windowId', () => windowId);
args.putIfAbsent('initialUserScripts', () => initialUserScripts?.map((e) => e.toMap()).toList() ?? []); args.putIfAbsent('initialUserScripts',
() => initialUserScripts?.map((e) => e.toMap()).toList() ?? []);
await _sharedChannel.invokeMethod('openData', args); await _sharedChannel.invokeMethod('openData', args);
} }
@ -360,8 +367,7 @@ class InAppBrowser {
///[url] represents the url of the request. ///[url] represents the url of the request.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler
Future<CustomSchemeResponse?>? onLoadResourceCustomScheme( Future<CustomSchemeResponse?>? onLoadResourceCustomScheme(Uri url) {}
Uri url) {}
///Event fired when the [InAppBrowser] webview requests the host application to create a new window, ///Event fired when the [InAppBrowser] webview requests the host application to create a new window,
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side. ///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
@ -518,7 +524,8 @@ class InAppBrowser {
///[fetchRequest] represents a resource request. ///[fetchRequest] represents a resource request.
/// ///
///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`. ///**NOTE**: In order to be able to listen this event, you need to set [InAppWebViewOptions.useShouldInterceptFetchRequest] option to `true`.
Future<FetchRequest?>? shouldInterceptFetchRequest(FetchRequest fetchRequest) {} Future<FetchRequest?>? shouldInterceptFetchRequest(
FetchRequest fetchRequest) {}
///Event fired when the host application updates its visited links database. ///Event fired when the host application updates its visited links database.
///This event is also fired when the navigation state of the [InAppWebView] changes through the usage of ///This event is also fired when the navigation state of the [InAppWebView] changes through the usage of
@ -643,8 +650,8 @@ class InAppBrowser {
///**Official Android API**: ///**Official Android API**:
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest) ///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)
///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String) ///- https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20java.lang.String)
Future<WebResourceResponse?>? Future<WebResourceResponse?>? androidShouldInterceptRequest(
androidShouldInterceptRequest(WebResourceRequest request) {} WebResourceRequest request) {}
///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript. ///Event called when the renderer currently associated with the WebView becomes unresponsive as a result of a long running blocking task such as the execution of JavaScript.
/// ///
@ -664,8 +671,8 @@ class InAppBrowser {
///**NOTE**: available only on Android 29+. ///**NOTE**: available only on Android 29+.
/// ///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
Future<WebViewRenderProcessAction?>? Future<WebViewRenderProcessAction?>? androidOnRenderProcessUnresponsive(
androidOnRenderProcessUnresponsive(Uri? url) {} Uri? url) {}
///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive. ///Event called once when an unresponsive renderer currently associated with the WebView becomes responsive.
/// ///
@ -678,8 +685,8 @@ class InAppBrowser {
///**NOTE**: available only on Android 29+. ///**NOTE**: available only on Android 29+.
/// ///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)
Future<WebViewRenderProcessAction?>? Future<WebViewRenderProcessAction?>? androidOnRenderProcessResponsive(
androidOnRenderProcessResponsive(Uri? url) {} Uri? url) {}
///Event fired when the given WebView's render process has exited. ///Event fired when the given WebView's render process has exited.
///The application's implementation of this callback should only attempt to clean up the WebView. ///The application's implementation of this callback should only attempt to clean up the WebView.
@ -697,8 +704,7 @@ class InAppBrowser {
///**NOTE**: available only on Android. ///**NOTE**: available only on Android.
/// ///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)
Future<FormResubmissionAction?>? Future<FormResubmissionAction?>? androidOnFormResubmission(Uri? url) {}
androidOnFormResubmission(Uri? url) {}
///Event fired when the scale applied to the WebView has changed. ///Event fired when the scale applied to the WebView has changed.
/// ///
@ -777,8 +783,8 @@ class InAppBrowser {
///**NOTE**: available only on iOS. ///**NOTE**: available only on iOS.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
Future<IOSNavigationResponseAction?>? Future<IOSNavigationResponseAction?>? iosOnNavigationResponse(
iosOnNavigationResponse(IOSWKNavigationResponse navigationResponse) {} IOSWKNavigationResponse navigationResponse) {}
///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1). ///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1).
/// ///
@ -787,8 +793,8 @@ class InAppBrowser {
///**NOTE**: available only on iOS 14.0+. ///**NOTE**: available only on iOS 14.0+.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview
Future<IOSShouldAllowDeprecatedTLSAction?>? Future<IOSShouldAllowDeprecatedTLSAction?>? iosShouldAllowDeprecatedTLS(
iosShouldAllowDeprecatedTLS(URLAuthenticationChallenge challenge) {} URLAuthenticationChallenge challenge) {}
void throwIfAlreadyOpened({String message = ''}) { void throwIfAlreadyOpened({String message = ''}) {
if (this.isOpened()) { if (this.isOpened()) {

View File

@ -35,7 +35,6 @@ class BrowserOptions {
} }
} }
///Class that represents the options that can be used for an [InAppBrowser] WebView. ///Class that represents the options that can be used for an [InAppBrowser] WebView.
class InAppBrowserClassOptions { class InAppBrowserClassOptions {
///Cross-platform options. ///Cross-platform options.
@ -52,9 +51,9 @@ class InAppBrowserClassOptions {
InAppBrowserClassOptions( InAppBrowserClassOptions(
{InAppBrowserOptions? crossPlatform, {InAppBrowserOptions? crossPlatform,
AndroidInAppBrowserOptions? android, AndroidInAppBrowserOptions? android,
IOSInAppBrowserOptions? ios, IOSInAppBrowserOptions? ios,
InAppWebViewGroupOptions? inAppWebViewGroupOptions}) { InAppWebViewGroupOptions? inAppWebViewGroupOptions}) {
this.crossPlatform = crossPlatform ?? InAppBrowserOptions(); this.crossPlatform = crossPlatform ?? InAppBrowserOptions();
this.android = android ?? AndroidInAppBrowserOptions(); this.android = android ?? AndroidInAppBrowserOptions();
this.ios = ios ?? IOSInAppBrowserOptions(); this.ios = ios ?? IOSInAppBrowserOptions();
@ -89,7 +88,7 @@ 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);
@ -157,7 +156,8 @@ class InAppBrowserOptions
InAppBrowserOptions options = InAppBrowserOptions(); InAppBrowserOptions options = InAppBrowserOptions();
options.hidden = map["hidden"]; options.hidden = map["hidden"];
options.hideToolbarTop = map["hideToolbarTop"]; options.hideToolbarTop = map["hideToolbarTop"];
options.toolbarTopBackgroundColor = UtilColor.fromHex(map["toolbarTopBackgroundColor"]); options.toolbarTopBackgroundColor =
UtilColor.fromHex(map["toolbarTopBackgroundColor"]);
options.hideUrlBar = map["hideUrlBar"]; options.hideUrlBar = map["hideUrlBar"];
options.hideProgressBar = map["hideProgressBar"]; options.hideProgressBar = map["hideProgressBar"];
return options; return options;

View File

@ -76,8 +76,10 @@ class IOSInAppBrowserOptions implements BrowserOptions, IosOptions {
options.toolbarTopTranslucent = map["toolbarTopTranslucent"]; options.toolbarTopTranslucent = map["toolbarTopTranslucent"];
options.toolbarTopTintColor = UtilColor.fromHex(map["toolbarTopTintColor"]); options.toolbarTopTintColor = UtilColor.fromHex(map["toolbarTopTintColor"]);
options.hideToolbarBottom = map["hideToolbarBottom"]; options.hideToolbarBottom = map["hideToolbarBottom"];
options.toolbarBottomBackgroundColor = UtilColor.fromHex(map["toolbarBottomBackgroundColor"]); options.toolbarBottomBackgroundColor =
options.toolbarBottomTintColor = UtilColor.fromHex(map["toolbarBottomTintColor"]); UtilColor.fromHex(map["toolbarBottomBackgroundColor"]);
options.toolbarBottomTintColor =
UtilColor.fromHex(map["toolbarBottomTintColor"]);
options.toolbarBottomTranslucent = map["toolbarBottomTranslucent"]; options.toolbarBottomTranslucent = map["toolbarBottomTranslucent"];
options.closeButtonCaption = map["closeButtonCaption"]; options.closeButtonCaption = map["closeButtonCaption"];
options.closeButtonColor = UtilColor.fromHex(map["closeButtonColor"]); options.closeButtonColor = UtilColor.fromHex(map["closeButtonColor"]);

View File

@ -1 +1 @@
export 'in_app_browser_options.dart'; export 'in_app_browser_options.dart';

View File

@ -1,4 +1,4 @@
export 'in_app_browser.dart'; export 'in_app_browser.dart';
export 'in_app_browser_options.dart'; export 'in_app_browser_options.dart';
export 'android/main.dart'; export 'android/main.dart';
export 'ios/main.dart'; export 'ios/main.dart';

View File

@ -1,3 +1,4 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const IN_APP_WEBVIEW_STATIC_CHANNEL = const MethodChannel('com.pichillilorenzo/flutter_inappwebview_static'); const IN_APP_WEBVIEW_STATIC_CHANNEL =
const MethodChannel('com.pichillilorenzo/flutter_inappwebview_static');

View File

@ -9,7 +9,6 @@ import '../../types.dart';
///Class represents the Android controller that contains only android-specific methods for the WebView. ///Class represents the Android controller that contains only android-specific methods for the WebView.
class AndroidInAppWebViewController { class AndroidInAppWebViewController {
late MethodChannel _channel; late MethodChannel _channel;
static MethodChannel _staticChannel = IN_APP_WEBVIEW_STATIC_CHANNEL; static MethodChannel _staticChannel = IN_APP_WEBVIEW_STATIC_CHANNEL;
@ -130,8 +129,7 @@ class AndroidInAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#clearClientCertPreferences(java.lang.Runnable)
static Future<void> clearClientCertPreferences() async { static Future<void> clearClientCertPreferences() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
await _staticChannel await _staticChannel.invokeMethod('clearClientCertPreferences', args);
.invokeMethod('clearClientCertPreferences', args);
} }
///Returns a URL pointing to the privacy policy for Safe Browsing reporting. ///Returns a URL pointing to the privacy policy for Safe Browsing reporting.
@ -141,8 +139,8 @@ class AndroidInAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl() ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getSafeBrowsingPrivacyPolicyUrl()
static Future<Uri?> getSafeBrowsingPrivacyPolicyUrl() async { static Future<Uri?> getSafeBrowsingPrivacyPolicyUrl() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
String? url = await _staticChannel String? url = await _staticChannel.invokeMethod(
.invokeMethod('getSafeBrowsingPrivacyPolicyUrl', args); 'getSafeBrowsingPrivacyPolicyUrl', args);
return url != null ? Uri.parse(url) : null; return url != null ? Uri.parse(url) : null;
} }
@ -167,8 +165,7 @@ class AndroidInAppWebViewController {
{required List<String> hosts}) async { {required List<String> hosts}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('hosts', () => hosts); args.putIfAbsent('hosts', () => hosts);
return await _staticChannel return await _staticChannel.invokeMethod('setSafeBrowsingWhitelist', args);
.invokeMethod('setSafeBrowsingWhitelist', args);
} }
///If WebView has already been loaded into the current process this method will return the package that was used to load it. ///If WebView has already been loaded into the current process this method will return the package that was used to load it.
@ -184,9 +181,9 @@ class AndroidInAppWebViewController {
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context) ///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewCompat#getCurrentWebViewPackage(android.content.Context)
static Future<AndroidWebViewPackageInfo?> getCurrentWebViewPackage() async { static Future<AndroidWebViewPackageInfo?> getCurrentWebViewPackage() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? packageInfo = (await _staticChannel Map<String, dynamic>? packageInfo =
.invokeMethod('getCurrentWebViewPackage', args)) (await _staticChannel.invokeMethod('getCurrentWebViewPackage', args))
?.cast<String, dynamic>(); ?.cast<String, dynamic>();
return AndroidWebViewPackageInfo.fromMap(packageInfo); return AndroidWebViewPackageInfo.fromMap(packageInfo);
} }
@ -199,11 +196,11 @@ class AndroidInAppWebViewController {
///**NOTE**: available only on Android 19+. ///**NOTE**: available only on Android 19+.
/// ///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setWebContentsDebuggingEnabled(boolean) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebView#setWebContentsDebuggingEnabled(boolean)
static Future<void> setWebContentsDebuggingEnabled(bool debuggingEnabled) async { static Future<void> setWebContentsDebuggingEnabled(
bool debuggingEnabled) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('debuggingEnabled', () => debuggingEnabled); args.putIfAbsent('debuggingEnabled', () => debuggingEnabled);
return await _staticChannel return await _staticChannel.invokeMethod(
.invokeMethod('setWebContentsDebuggingEnabled', args); 'setWebContentsDebuggingEnabled', args);
} }
} }

View File

@ -1,2 +1,2 @@
export 'in_app_webview_options.dart'; export 'in_app_webview_options.dart';
export 'in_app_webview_controller.dart'; export 'in_app_webview_controller.dart';

View File

@ -113,13 +113,16 @@ class HeadlessInAppWebView implements WebView {
args.putIfAbsent( args.putIfAbsent(
'params', 'params',
() => <String, dynamic>{ () => <String, dynamic>{
'initialUrlRequest': (this.initialUrlRequest ?? URLRequest(url: Uri.parse("about:blank"))).toMap(), 'initialUrlRequest': (this.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialFile': this.initialFile, 'initialFile': this.initialFile,
'initialData': this.initialData?.toMap(), 'initialData': this.initialData?.toMap(),
'initialOptions': this.initialOptions?.toMap() ?? {}, 'initialOptions': this.initialOptions?.toMap() ?? {},
'contextMenu': this.contextMenu?.toMap() ?? {}, 'contextMenu': this.contextMenu?.toMap() ?? {},
'windowId': this.windowId, 'windowId': this.windowId,
'initialUserScripts': this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], 'initialUserScripts':
this.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
}); });
await _sharedChannel.invokeMethod('createHeadlessWebView', args); await _sharedChannel.invokeMethod('createHeadlessWebView', args);
} }
@ -151,8 +154,10 @@ class HeadlessInAppWebView implements WebView {
List<String> resources)? androidOnPermissionRequest; List<String> resources)? androidOnPermissionRequest;
@override @override
final Future<SafeBrowsingResponse?> Function(InAppWebViewController controller, final Future<SafeBrowsingResponse?> Function(
Uri url, SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit; InAppWebViewController controller,
Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
@override @override
final InAppWebViewInitialData? initialData; final InAppWebViewInitialData? initialData;
@ -189,14 +194,14 @@ class HeadlessInAppWebView implements WebView {
iosOnWebContentProcessDidTerminate; iosOnWebContentProcessDidTerminate;
@override @override
final Future<IOSNavigationResponseAction?> Function(InAppWebViewController controller, final Future<IOSNavigationResponseAction?> Function(
IOSWKNavigationResponse navigationResponse)? InAppWebViewController controller,
iosOnNavigationResponse; IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
@override @override
final Future<IOSShouldAllowDeprecatedTLSAction?> Function(InAppWebViewController controller, final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
URLAuthenticationChallenge challenge)? InAppWebViewController controller,
iosShouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
@override @override
final Future<AjaxRequestAction> Function( final Future<AjaxRequestAction> Function(
@ -264,12 +269,10 @@ class HeadlessInAppWebView implements WebView {
@override @override
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
onLoadResourceCustomScheme;
@override @override
final void Function(InAppWebViewController controller, Uri? url)? final void Function(InAppWebViewController controller, Uri? url)? onLoadStart;
onLoadStart;
@override @override
final void Function(InAppWebViewController controller, Uri? url)? onLoadStop; final void Function(InAppWebViewController controller, Uri? url)? onLoadStop;
@ -286,19 +289,17 @@ class HeadlessInAppWebView implements WebView {
onProgressChanged; onProgressChanged;
@override @override
final Future<ClientCertResponse?> Function( final Future<ClientCertResponse?> Function(InAppWebViewController controller,
InAppWebViewController controller, URLAuthenticationChallenge challenge)? URLAuthenticationChallenge challenge)? onReceivedClientCertRequest;
onReceivedClientCertRequest;
@override @override
final Future<HttpAuthResponse?> Function( final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
InAppWebViewController controller, URLAuthenticationChallenge challenge)? URLAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
onReceivedHttpAuthRequest;
@override @override
final Future<ServerTrustAuthResponse?> Function( final Future<ServerTrustAuthResponse?> Function(
InAppWebViewController controller, URLAuthenticationChallenge challenge)? InAppWebViewController controller,
onReceivedServerTrustAuthRequest; URLAuthenticationChallenge challenge)? onReceivedServerTrustAuthRequest;
@override @override
final void Function(InAppWebViewController controller, int x, int y)? final void Function(InAppWebViewController controller, int x, int y)?

View File

@ -113,8 +113,10 @@ class InAppWebView extends StatefulWidget implements WebView {
List<String> resources)? androidOnPermissionRequest; List<String> resources)? androidOnPermissionRequest;
@override @override
final Future<SafeBrowsingResponse?> Function(InAppWebViewController controller, final Future<SafeBrowsingResponse?> Function(
Uri url, SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit; InAppWebViewController controller,
Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
@override @override
final InAppWebViewInitialData? initialData; final InAppWebViewInitialData? initialData;
@ -151,14 +153,14 @@ class InAppWebView extends StatefulWidget implements WebView {
iosOnWebContentProcessDidTerminate; iosOnWebContentProcessDidTerminate;
@override @override
final Future<IOSNavigationResponseAction?> Function(InAppWebViewController controller, final Future<IOSNavigationResponseAction?> Function(
IOSWKNavigationResponse navigationResponse)? InAppWebViewController controller,
iosOnNavigationResponse; IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
@override @override
final Future<IOSShouldAllowDeprecatedTLSAction?> Function(InAppWebViewController controller, final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
URLAuthenticationChallenge challenge)? InAppWebViewController controller,
iosShouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
@override @override
final Future<AjaxRequestAction> Function( final Future<AjaxRequestAction> Function(
@ -235,12 +237,10 @@ class InAppWebView extends StatefulWidget implements WebView {
@override @override
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
onLoadResourceCustomScheme;
@override @override
final void Function(InAppWebViewController controller, Uri? url)? final void Function(InAppWebViewController controller, Uri? url)? onLoadStart;
onLoadStart;
@override @override
final void Function(InAppWebViewController controller, Uri? url)? onLoadStop; final void Function(InAppWebViewController controller, Uri? url)? onLoadStop;
@ -257,19 +257,17 @@ class InAppWebView extends StatefulWidget implements WebView {
onProgressChanged; onProgressChanged;
@override @override
final Future<ClientCertResponse?> Function( final Future<ClientCertResponse?> Function(InAppWebViewController controller,
InAppWebViewController controller, URLAuthenticationChallenge challenge)? URLAuthenticationChallenge challenge)? onReceivedClientCertRequest;
onReceivedClientCertRequest;
@override @override
final Future<HttpAuthResponse?> Function( final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
InAppWebViewController controller, URLAuthenticationChallenge challenge)? URLAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
onReceivedHttpAuthRequest;
@override @override
final Future<ServerTrustAuthResponse?> Function( final Future<ServerTrustAuthResponse?> Function(
InAppWebViewController controller, URLAuthenticationChallenge challenge)? InAppWebViewController controller,
onReceivedServerTrustAuthRequest; URLAuthenticationChallenge challenge)? onReceivedServerTrustAuthRequest;
@override @override
final void Function(InAppWebViewController controller, int x, int y)? final void Function(InAppWebViewController controller, int x, int y)?
@ -354,12 +352,13 @@ class _InAppWebViewState extends State<InAppWebView> {
return PlatformViewLink( return PlatformViewLink(
viewType: 'com.pichillilorenzo/flutter_inappwebview', viewType: 'com.pichillilorenzo/flutter_inappwebview',
surfaceFactory: ( surfaceFactory: (
BuildContext context, BuildContext context,
PlatformViewController controller, PlatformViewController controller,
) { ) {
return AndroidViewSurface( return AndroidViewSurface(
controller: controller as AndroidViewController, controller: controller as AndroidViewController,
gestureRecognizers: widget.gestureRecognizers ?? const <Factory<OneSequenceGestureRecognizer>>{}, gestureRecognizers: widget.gestureRecognizers ??
const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque, hitTestBehavior: PlatformViewHitTestBehavior.opaque,
); );
}, },
@ -369,18 +368,23 @@ class _InAppWebViewState extends State<InAppWebView> {
viewType: 'com.pichillilorenzo/flutter_inappwebview', viewType: 'com.pichillilorenzo/flutter_inappwebview',
layoutDirection: TextDirection.rtl, layoutDirection: TextDirection.rtl,
creationParams: <String, dynamic>{ creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ?? URLRequest(url: Uri.parse("about:blank"))).toMap(), 'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialFile': widget.initialFile, 'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(), 'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {}, 'initialOptions': widget.initialOptions?.toMap() ?? {},
'contextMenu': widget.contextMenu?.toMap() ?? {}, 'contextMenu': widget.contextMenu?.toMap() ?? {},
'windowId': widget.windowId, 'windowId': widget.windowId,
'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ??
[],
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
) )
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..addOnPlatformViewCreatedListener((id) => _onPlatformViewCreated(id)) ..addOnPlatformViewCreatedListener(
(id) => _onPlatformViewCreated(id))
..create(); ..create();
}, },
); );
@ -391,13 +395,16 @@ class _InAppWebViewState extends State<InAppWebView> {
gestureRecognizers: widget.gestureRecognizers, gestureRecognizers: widget.gestureRecognizers,
layoutDirection: TextDirection.rtl, layoutDirection: TextDirection.rtl,
creationParams: <String, dynamic>{ creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ?? URLRequest(url: Uri.parse("about:blank"))).toMap(), 'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialFile': widget.initialFile, 'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(), 'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {}, 'initialOptions': widget.initialOptions?.toMap() ?? {},
'contextMenu': widget.contextMenu?.toMap() ?? {}, 'contextMenu': widget.contextMenu?.toMap() ?? {},
'windowId': widget.windowId, 'windowId': widget.windowId,
'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
); );
@ -408,13 +415,16 @@ class _InAppWebViewState extends State<InAppWebView> {
onPlatformViewCreated: _onPlatformViewCreated, onPlatformViewCreated: _onPlatformViewCreated,
gestureRecognizers: widget.gestureRecognizers, gestureRecognizers: widget.gestureRecognizers,
creationParams: <String, dynamic>{ creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ?? URLRequest(url: Uri.parse("about:blank"))).toMap(), 'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialFile': widget.initialFile, 'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(), 'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {}, 'initialOptions': widget.initialOptions?.toMap() ?? {},
'contextMenu': widget.contextMenu?.toMap() ?? {}, 'contextMenu': widget.contextMenu?.toMap() ?? {},
'windowId': widget.windowId, 'windowId': widget.windowId,
'initialUserScripts': widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [], 'initialUserScripts':
widget.initialUserScripts?.map((e) => e.toMap()).toList() ?? [],
}, },
creationParamsCodec: const StandardMessageCodec(), creationParamsCodec: const StandardMessageCodec(),
); );

View File

@ -77,16 +77,21 @@ class InAppWebViewController {
MethodChannel('com.pichillilorenzo/flutter_inappwebview_$id'); MethodChannel('com.pichillilorenzo/flutter_inappwebview_$id');
this._channel.setMethodCallHandler(handleMethod); this._channel.setMethodCallHandler(handleMethod);
this._webview = webview; this._webview = webview;
this._userScripts = List<UserScript>.from(webview.initialUserScripts ?? <UserScript>[]); this._userScripts =
List<UserScript>.from(webview.initialUserScripts ?? <UserScript>[]);
this._init(); this._init();
} }
InAppWebViewController.fromInAppBrowser( InAppWebViewController.fromInAppBrowser(
String uuid, MethodChannel channel, InAppBrowser inAppBrowser, UnmodifiableListView<UserScript>? initialUserScripts) { String uuid,
MethodChannel channel,
InAppBrowser inAppBrowser,
UnmodifiableListView<UserScript>? initialUserScripts) {
this._inAppBrowserUuid = uuid; this._inAppBrowserUuid = uuid;
this._channel = channel; this._channel = channel;
this._inAppBrowser = inAppBrowser; this._inAppBrowser = inAppBrowser;
this._userScripts = List<UserScript>.from(initialUserScripts ?? <UserScript>[]); this._userScripts =
List<UserScript>.from(initialUserScripts ?? <UserScript>[]);
this._init(); this._init();
} }
@ -100,11 +105,14 @@ class InAppWebViewController {
Future<dynamic> handleMethod(MethodCall call) async { Future<dynamic> handleMethod(MethodCall call) async {
switch (call.method) { switch (call.method) {
case "onHeadlessWebViewCreated": case "onHeadlessWebViewCreated":
if (_webview != null && _webview is HeadlessInAppWebView && _webview!.onWebViewCreated != null) if (_webview != null &&
_webview is HeadlessInAppWebView &&
_webview!.onWebViewCreated != null)
_webview!.onWebViewCreated!(this); _webview!.onWebViewCreated!(this);
break; break;
case "onLoadStart": case "onLoadStart":
if ((_webview != null && _webview!.onLoadStart != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLoadStart != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.onLoadStart != null) if (_webview != null && _webview!.onLoadStart != null)
@ -114,7 +122,8 @@ class InAppWebViewController {
} }
break; break;
case "onLoadStop": case "onLoadStop":
if ((_webview != null && _webview!.onLoadStop != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLoadStop != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.onLoadStop != null) if (_webview != null && _webview!.onLoadStop != null)
@ -124,7 +133,8 @@ class InAppWebViewController {
} }
break; break;
case "onLoadError": case "onLoadError":
if ((_webview != null && _webview!.onLoadError != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLoadError != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
int code = call.arguments["code"]; int code = call.arguments["code"];
String message = call.arguments["message"]; String message = call.arguments["message"];
@ -136,7 +146,8 @@ class InAppWebViewController {
} }
break; break;
case "onLoadHttpError": case "onLoadHttpError":
if ((_webview != null && _webview!.onLoadHttpError != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLoadHttpError != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
int statusCode = call.arguments["statusCode"]; int statusCode = call.arguments["statusCode"];
String description = call.arguments["description"]; String description = call.arguments["description"];
@ -148,7 +159,8 @@ class InAppWebViewController {
} }
break; break;
case "onProgressChanged": case "onProgressChanged":
if ((_webview != null && _webview!.onProgressChanged != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onProgressChanged != null) ||
_inAppBrowser != null) {
int progress = call.arguments["progress"]; int progress = call.arguments["progress"];
if (_webview != null && _webview!.onProgressChanged != null) if (_webview != null && _webview!.onProgressChanged != null)
_webview!.onProgressChanged!(this, progress); _webview!.onProgressChanged!(this, progress);
@ -157,22 +169,27 @@ class InAppWebViewController {
} }
break; break;
case "shouldOverrideUrlLoading": case "shouldOverrideUrlLoading":
if ((_webview != null && _webview!.shouldOverrideUrlLoading != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.shouldOverrideUrlLoading != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
NavigationAction navigationAction = NavigationAction.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
NavigationAction navigationAction =
NavigationAction.fromMap(arguments)!;
if (_webview != null && _webview!.shouldOverrideUrlLoading != null) if (_webview != null && _webview!.shouldOverrideUrlLoading != null)
return (await _webview!.shouldOverrideUrlLoading!( return (await _webview!.shouldOverrideUrlLoading!(
this, navigationAction)) this, navigationAction))
?.toMap(); ?.toMap();
return (await _inAppBrowser! return (await _inAppBrowser!
.shouldOverrideUrlLoading(navigationAction)) .shouldOverrideUrlLoading(navigationAction))
?.toMap(); ?.toMap();
} }
break; break;
case "onConsoleMessage": case "onConsoleMessage":
if ((_webview != null && _webview!.onConsoleMessage != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onConsoleMessage != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
ConsoleMessage consoleMessage = ConsoleMessage.fromMap(arguments)!; ConsoleMessage consoleMessage = ConsoleMessage.fromMap(arguments)!;
if (_webview != null && _webview!.onConsoleMessage != null) if (_webview != null && _webview!.onConsoleMessage != null)
_webview!.onConsoleMessage!(this, consoleMessage); _webview!.onConsoleMessage!(this, consoleMessage);
@ -181,7 +198,8 @@ class InAppWebViewController {
} }
break; break;
case "onScrollChanged": case "onScrollChanged":
if ((_webview != null && _webview!.onScrollChanged != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onScrollChanged != null) ||
_inAppBrowser != null) {
int x = call.arguments["x"]; int x = call.arguments["x"];
int y = call.arguments["y"]; int y = call.arguments["y"];
if (_webview != null && _webview!.onScrollChanged != null) if (_webview != null && _webview!.onScrollChanged != null)
@ -191,7 +209,8 @@ class InAppWebViewController {
} }
break; break;
case "onDownloadStart": case "onDownloadStart":
if ((_webview != null && _webview!.onDownloadStart != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onDownloadStart != null) ||
_inAppBrowser != null) {
String url = call.arguments["url"]; String url = call.arguments["url"];
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (_webview != null && _webview!.onDownloadStart != null) if (_webview != null && _webview!.onDownloadStart != null)
@ -201,19 +220,26 @@ class InAppWebViewController {
} }
break; break;
case "onLoadResourceCustomScheme": case "onLoadResourceCustomScheme":
if ((_webview != null && _webview!.onLoadResourceCustomScheme != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.onLoadResourceCustomScheme != null) ||
_inAppBrowser != null) {
String url = call.arguments["url"]; String url = call.arguments["url"];
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (_webview != null && _webview!.onLoadResourceCustomScheme != null) if (_webview != null && _webview!.onLoadResourceCustomScheme != null)
return (await _webview!.onLoadResourceCustomScheme!(this, uri))?.toMap(); return (await _webview!.onLoadResourceCustomScheme!(this, uri))
?.toMap();
else else
return (await _inAppBrowser!.onLoadResourceCustomScheme(uri))?.toMap(); return (await _inAppBrowser!.onLoadResourceCustomScheme(uri))
?.toMap();
} }
break; break;
case "onCreateWindow": case "onCreateWindow":
if ((_webview != null && _webview!.onCreateWindow != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onCreateWindow != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
CreateWindowAction createWindowAction = CreateWindowAction.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
CreateWindowAction createWindowAction =
CreateWindowAction.fromMap(arguments)!;
if (_webview != null && _webview!.onCreateWindow != null) if (_webview != null && _webview!.onCreateWindow != null)
return await _webview!.onCreateWindow!(this, createWindowAction); return await _webview!.onCreateWindow!(this, createWindowAction);
@ -227,7 +253,8 @@ class InAppWebViewController {
else if (_inAppBrowser != null) _inAppBrowser!.onCloseWindow(); else if (_inAppBrowser != null) _inAppBrowser!.onCloseWindow();
break; break;
case "onTitleChanged": case "onTitleChanged":
if ((_webview != null && _webview!.onTitleChanged != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onTitleChanged != null) ||
_inAppBrowser != null) {
String? title = call.arguments["title"]; String? title = call.arguments["title"];
if (_webview != null && _webview!.onTitleChanged != null) if (_webview != null && _webview!.onTitleChanged != null)
_webview!.onTitleChanged!(this, title); _webview!.onTitleChanged!(this, title);
@ -236,31 +263,40 @@ class InAppWebViewController {
} }
break; break;
case "onGeolocationPermissionsShowPrompt": case "onGeolocationPermissionsShowPrompt":
if ((_webview != null && _webview!.androidOnGeolocationPermissionsShowPrompt != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.androidOnGeolocationPermissionsShowPrompt != null) ||
_inAppBrowser != null) {
String origin = call.arguments["origin"]; String origin = call.arguments["origin"];
if (_webview != null && _webview!.androidOnGeolocationPermissionsShowPrompt != null) if (_webview != null &&
_webview!.androidOnGeolocationPermissionsShowPrompt != null)
return (await _webview!.androidOnGeolocationPermissionsShowPrompt!( return (await _webview!.androidOnGeolocationPermissionsShowPrompt!(
this, origin)) this, origin))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser! return (await _inAppBrowser!
.androidOnGeolocationPermissionsShowPrompt(origin)) .androidOnGeolocationPermissionsShowPrompt(origin))
?.toMap(); ?.toMap();
} }
break; break;
case "onGeolocationPermissionsHidePrompt": case "onGeolocationPermissionsHidePrompt":
if (_webview != null && _webview!.androidOnGeolocationPermissionsHidePrompt != null) if (_webview != null &&
_webview!.androidOnGeolocationPermissionsHidePrompt != null)
_webview!.androidOnGeolocationPermissionsHidePrompt!(this); _webview!.androidOnGeolocationPermissionsHidePrompt!(this);
else if (_inAppBrowser != null) else if (_inAppBrowser != null)
_inAppBrowser!.androidOnGeolocationPermissionsHidePrompt(); _inAppBrowser!.androidOnGeolocationPermissionsHidePrompt();
break; break;
case "shouldInterceptRequest": case "shouldInterceptRequest":
if ((_webview != null && _webview!.androidShouldInterceptRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.androidShouldInterceptRequest != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
WebResourceRequest request = WebResourceRequest.fromMap(arguments)!; WebResourceRequest request = WebResourceRequest.fromMap(arguments)!;
if (_webview != null && _webview!.androidShouldInterceptRequest != null) if (_webview != null &&
return (await _webview!.androidShouldInterceptRequest!(this, request)) _webview!.androidShouldInterceptRequest != null)
return (await _webview!.androidShouldInterceptRequest!(
this, request))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.androidShouldInterceptRequest(request)) return (await _inAppBrowser!.androidShouldInterceptRequest(request))
@ -268,23 +304,32 @@ class InAppWebViewController {
} }
break; break;
case "onRenderProcessUnresponsive": case "onRenderProcessUnresponsive":
if ((_webview != null && _webview!.androidOnRenderProcessUnresponsive != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.androidOnRenderProcessUnresponsive != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.androidOnRenderProcessUnresponsive != null) if (_webview != null &&
return (await _webview!.androidOnRenderProcessUnresponsive!(this, uri)) _webview!.androidOnRenderProcessUnresponsive != null)
return (await _webview!.androidOnRenderProcessUnresponsive!(
this, uri))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.androidOnRenderProcessUnresponsive(uri)) return (await _inAppBrowser!
.androidOnRenderProcessUnresponsive(uri))
?.toMap(); ?.toMap();
} }
break; break;
case "onRenderProcessResponsive": case "onRenderProcessResponsive":
if ((_webview != null && _webview!.androidOnRenderProcessResponsive != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.androidOnRenderProcessResponsive != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.androidOnRenderProcessResponsive != null) if (_webview != null &&
return (await _webview!.androidOnRenderProcessResponsive!(this, uri)) _webview!.androidOnRenderProcessResponsive != null)
return (await _webview!.androidOnRenderProcessResponsive!(
this, uri))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.androidOnRenderProcessResponsive(uri)) return (await _inAppBrowser!.androidOnRenderProcessResponsive(uri))
@ -292,9 +337,13 @@ class InAppWebViewController {
} }
break; break;
case "onRenderProcessGone": case "onRenderProcessGone":
if ((_webview != null && _webview!.androidOnRenderProcessGone != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.androidOnRenderProcessGone != null) ||
RenderProcessGoneDetail detail = RenderProcessGoneDetail.fromMap(arguments)!; _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
RenderProcessGoneDetail detail =
RenderProcessGoneDetail.fromMap(arguments)!;
if (_webview != null && _webview!.androidOnRenderProcessGone != null) if (_webview != null && _webview!.androidOnRenderProcessGone != null)
_webview!.androidOnRenderProcessGone!(this, detail); _webview!.androidOnRenderProcessGone!(this, detail);
@ -303,17 +352,21 @@ class InAppWebViewController {
} }
break; break;
case "onFormResubmission": case "onFormResubmission":
if ((_webview != null && _webview!.androidOnFormResubmission != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.androidOnFormResubmission != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.androidOnFormResubmission != null) if (_webview != null && _webview!.androidOnFormResubmission != null)
return (await _webview!.androidOnFormResubmission!(this, uri))?.toMap(); return (await _webview!.androidOnFormResubmission!(this, uri))
?.toMap();
else else
return (await _inAppBrowser!.androidOnFormResubmission(uri))?.toMap(); return (await _inAppBrowser!.androidOnFormResubmission(uri))
?.toMap();
} }
break; break;
case "onScaleChanged": case "onScaleChanged":
if ((_webview != null && _webview!.androidOnScaleChanged != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.androidOnScaleChanged != null) ||
_inAppBrowser != null) {
double oldScale = call.arguments["oldScale"]; double oldScale = call.arguments["oldScale"];
double newScale = call.arguments["newScale"]; double newScale = call.arguments["newScale"];
if (_webview != null && _webview!.androidOnScaleChanged != null) if (_webview != null && _webview!.androidOnScaleChanged != null)
@ -323,8 +376,10 @@ class InAppWebViewController {
} }
break; break;
case "onReceivedIcon": case "onReceivedIcon":
if ((_webview != null && _webview!.androidOnReceivedIcon != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.androidOnReceivedIcon != null) ||
Uint8List icon = Uint8List.fromList(call.arguments["icon"].cast<int>()); _inAppBrowser != null) {
Uint8List icon =
Uint8List.fromList(call.arguments["icon"].cast<int>());
if (_webview != null && _webview!.androidOnReceivedIcon != null) if (_webview != null && _webview!.androidOnReceivedIcon != null)
_webview!.androidOnReceivedIcon!(this, icon); _webview!.androidOnReceivedIcon!(this, icon);
@ -333,19 +388,24 @@ class InAppWebViewController {
} }
break; break;
case "onReceivedTouchIconUrl": case "onReceivedTouchIconUrl":
if ((_webview != null && _webview!.androidOnReceivedTouchIconUrl != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.androidOnReceivedTouchIconUrl != null) ||
_inAppBrowser != null) {
String url = call.arguments["url"]; String url = call.arguments["url"];
bool precomposed = call.arguments["precomposed"]; bool precomposed = call.arguments["precomposed"];
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (_webview != null && _webview!.androidOnReceivedTouchIconUrl != null) if (_webview != null &&
_webview!.androidOnReceivedTouchIconUrl != null)
_webview!.androidOnReceivedTouchIconUrl!(this, uri, precomposed); _webview!.androidOnReceivedTouchIconUrl!(this, uri, precomposed);
else else
_inAppBrowser!.androidOnReceivedTouchIconUrl(uri, precomposed); _inAppBrowser!.androidOnReceivedTouchIconUrl(uri, precomposed);
} }
break; break;
case "onJsAlert": case "onJsAlert":
if ((_webview != null && _webview!.onJsAlert != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onJsAlert != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
JsAlertRequest jsAlertRequest = JsAlertRequest.fromMap(arguments)!; JsAlertRequest jsAlertRequest = JsAlertRequest.fromMap(arguments)!;
if (_webview != null && _webview!.onJsAlert != null) if (_webview != null && _webview!.onJsAlert != null)
@ -355,72 +415,92 @@ class InAppWebViewController {
} }
break; break;
case "onJsConfirm": case "onJsConfirm":
if ((_webview != null && _webview!.onJsConfirm != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onJsConfirm != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
JsConfirmRequest jsConfirmRequest = JsConfirmRequest.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
JsConfirmRequest jsConfirmRequest =
JsConfirmRequest.fromMap(arguments)!;
if (_webview != null && _webview!.onJsConfirm != null) if (_webview != null && _webview!.onJsConfirm != null)
return (await _webview!.onJsConfirm!(this, jsConfirmRequest))?.toMap(); return (await _webview!.onJsConfirm!(this, jsConfirmRequest))
?.toMap();
else else
return (await _inAppBrowser!.onJsConfirm(jsConfirmRequest))?.toMap(); return (await _inAppBrowser!.onJsConfirm(jsConfirmRequest))
?.toMap();
} }
break; break;
case "onJsPrompt": case "onJsPrompt":
if ((_webview != null && _webview!.onJsPrompt != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onJsPrompt != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
JsPromptRequest jsPromptRequest = JsPromptRequest.fromMap(arguments)!; JsPromptRequest jsPromptRequest = JsPromptRequest.fromMap(arguments)!;
if (_webview != null && _webview!.onJsPrompt != null) if (_webview != null && _webview!.onJsPrompt != null)
return (await _webview!.onJsPrompt!(this, jsPromptRequest))?.toMap(); return (await _webview!.onJsPrompt!(this, jsPromptRequest))
?.toMap();
else else
return (await _inAppBrowser!.onJsPrompt(jsPromptRequest))?.toMap(); return (await _inAppBrowser!.onJsPrompt(jsPromptRequest))?.toMap();
} }
break; break;
case "onJsBeforeUnload": case "onJsBeforeUnload":
if ((_webview != null && _webview!.androidOnJsBeforeUnload != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.androidOnJsBeforeUnload != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
JsBeforeUnloadRequest jsBeforeUnloadRequest = JsBeforeUnloadRequest.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
JsBeforeUnloadRequest jsBeforeUnloadRequest =
JsBeforeUnloadRequest.fromMap(arguments)!;
if (_webview != null && _webview!.androidOnJsBeforeUnload != null) if (_webview != null && _webview!.androidOnJsBeforeUnload != null)
return (await _webview!.androidOnJsBeforeUnload!( return (await _webview!.androidOnJsBeforeUnload!(
this, jsBeforeUnloadRequest)) this, jsBeforeUnloadRequest))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser! return (await _inAppBrowser!
.androidOnJsBeforeUnload(jsBeforeUnloadRequest)) .androidOnJsBeforeUnload(jsBeforeUnloadRequest))
?.toMap(); ?.toMap();
} }
break; break;
case "onSafeBrowsingHit": case "onSafeBrowsingHit":
if ((_webview != null && _webview!.androidOnSafeBrowsingHit != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.androidOnSafeBrowsingHit != null) ||
_inAppBrowser != null) {
String url = call.arguments["url"]; String url = call.arguments["url"];
SafeBrowsingThreat? threatType = SafeBrowsingThreat? threatType =
SafeBrowsingThreat.fromValue(call.arguments["threatType"]); SafeBrowsingThreat.fromValue(call.arguments["threatType"]);
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
if (_webview != null && _webview!.androidOnSafeBrowsingHit != null) if (_webview != null && _webview!.androidOnSafeBrowsingHit != null)
return (await _webview!.androidOnSafeBrowsingHit!( return (await _webview!.androidOnSafeBrowsingHit!(
this, uri, threatType)) this, uri, threatType))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.androidOnSafeBrowsingHit(uri, threatType)) return (await _inAppBrowser!
.androidOnSafeBrowsingHit(uri, threatType))
?.toMap(); ?.toMap();
} }
break; break;
case "onReceivedLoginRequest": case "onReceivedLoginRequest":
if ((_webview != null && _webview!.androidOnReceivedLoginRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.androidOnReceivedLoginRequest != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
LoginRequest loginRequest = LoginRequest.fromMap(arguments)!; LoginRequest loginRequest = LoginRequest.fromMap(arguments)!;
if (_webview != null && _webview!.androidOnReceivedLoginRequest != null) if (_webview != null &&
_webview!.androidOnReceivedLoginRequest != null)
_webview!.androidOnReceivedLoginRequest!(this, loginRequest); _webview!.androidOnReceivedLoginRequest!(this, loginRequest);
else else
_inAppBrowser!.androidOnReceivedLoginRequest(loginRequest); _inAppBrowser!.androidOnReceivedLoginRequest(loginRequest);
} }
break; break;
case "onReceivedHttpAuthRequest": case "onReceivedHttpAuthRequest":
if ((_webview != null && _webview!.onReceivedHttpAuthRequest != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onReceivedHttpAuthRequest != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
HttpAuthenticationChallenge challenge = HttpAuthenticationChallenge.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
HttpAuthenticationChallenge challenge =
HttpAuthenticationChallenge.fromMap(arguments)!;
if (_webview != null && _webview!.onReceivedHttpAuthRequest != null) if (_webview != null && _webview!.onReceivedHttpAuthRequest != null)
return (await _webview!.onReceivedHttpAuthRequest!(this, challenge)) return (await _webview!.onReceivedHttpAuthRequest!(this, challenge))
@ -431,27 +511,37 @@ class InAppWebViewController {
} }
break; break;
case "onReceivedServerTrustAuthRequest": case "onReceivedServerTrustAuthRequest":
if ((_webview != null && _webview!.onReceivedServerTrustAuthRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.onReceivedServerTrustAuthRequest != null) ||
ServerTrustChallenge challenge = ServerTrustChallenge.fromMap(arguments)!; _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
ServerTrustChallenge challenge =
ServerTrustChallenge.fromMap(arguments)!;
if (_webview != null && _webview!.onReceivedServerTrustAuthRequest != null) if (_webview != null &&
_webview!.onReceivedServerTrustAuthRequest != null)
return (await _webview!.onReceivedServerTrustAuthRequest!( return (await _webview!.onReceivedServerTrustAuthRequest!(
this, challenge)) this, challenge))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser! return (await _inAppBrowser!
.onReceivedServerTrustAuthRequest(challenge)) .onReceivedServerTrustAuthRequest(challenge))
?.toMap(); ?.toMap();
} }
break; break;
case "onReceivedClientCertRequest": case "onReceivedClientCertRequest":
if ((_webview != null && _webview!.onReceivedClientCertRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.onReceivedClientCertRequest != null) ||
ClientCertChallenge challenge = ClientCertChallenge.fromMap(arguments)!; _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
ClientCertChallenge challenge =
ClientCertChallenge.fromMap(arguments)!;
if (_webview != null && _webview!.onReceivedClientCertRequest != null) if (_webview != null && _webview!.onReceivedClientCertRequest != null)
return (await _webview!.onReceivedClientCertRequest!(this, challenge)) return (await _webview!.onReceivedClientCertRequest!(
this, challenge))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.onReceivedClientCertRequest(challenge)) return (await _inAppBrowser!.onReceivedClientCertRequest(challenge))
@ -459,7 +549,8 @@ class InAppWebViewController {
} }
break; break;
case "onFindResultReceived": case "onFindResultReceived":
if ((_webview != null && _webview!.onFindResultReceived != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onFindResultReceived != null) ||
_inAppBrowser != null) {
int activeMatchOrdinal = call.arguments["activeMatchOrdinal"]; int activeMatchOrdinal = call.arguments["activeMatchOrdinal"];
int numberOfMatches = call.arguments["numberOfMatches"]; int numberOfMatches = call.arguments["numberOfMatches"];
bool isDoneCounting = call.arguments["isDoneCounting"]; bool isDoneCounting = call.arguments["isDoneCounting"];
@ -472,21 +563,24 @@ class InAppWebViewController {
} }
break; break;
case "onPermissionRequest": case "onPermissionRequest":
if ((_webview != null && _webview!.androidOnPermissionRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.androidOnPermissionRequest != null) ||
_inAppBrowser != null) {
String origin = call.arguments["origin"]; String origin = call.arguments["origin"];
List<String> resources = call.arguments["resources"].cast<String>(); List<String> resources = call.arguments["resources"].cast<String>();
if (_webview != null && _webview!.androidOnPermissionRequest != null) if (_webview != null && _webview!.androidOnPermissionRequest != null)
return (await _webview!.androidOnPermissionRequest!( return (await _webview!.androidOnPermissionRequest!(
this, origin, resources)) this, origin, resources))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser!.androidOnPermissionRequest( return (await _inAppBrowser!
origin, resources)) .androidOnPermissionRequest(origin, resources))
?.toMap(); ?.toMap();
} }
break; break;
case "onUpdateVisitedHistory": case "onUpdateVisitedHistory":
if ((_webview != null && _webview!.onUpdateVisitedHistory != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onUpdateVisitedHistory != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
bool? androidIsReload = call.arguments["androidIsReload"]; bool? androidIsReload = call.arguments["androidIsReload"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
@ -504,7 +598,8 @@ class InAppWebViewController {
_inAppBrowser!.iosOnWebContentProcessDidTerminate(); _inAppBrowser!.iosOnWebContentProcessDidTerminate();
break; break;
case "onPageCommitVisible": case "onPageCommitVisible":
if ((_webview != null && _webview!.onPageCommitVisible != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onPageCommitVisible != null) ||
_inAppBrowser != null) {
String? url = call.arguments["url"]; String? url = call.arguments["url"];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.onPageCommitVisible != null) if (_webview != null && _webview!.onPageCommitVisible != null)
@ -517,44 +612,55 @@ class InAppWebViewController {
if (_webview != null && if (_webview != null &&
_webview!.iosOnDidReceiveServerRedirectForProvisionalNavigation != _webview!.iosOnDidReceiveServerRedirectForProvisionalNavigation !=
null) null)
_webview!.iosOnDidReceiveServerRedirectForProvisionalNavigation!(this); _webview!
.iosOnDidReceiveServerRedirectForProvisionalNavigation!(this);
else if (_inAppBrowser != null) else if (_inAppBrowser != null)
_inAppBrowser!.iosOnDidReceiveServerRedirectForProvisionalNavigation(); _inAppBrowser!
.iosOnDidReceiveServerRedirectForProvisionalNavigation();
break; break;
case "onNavigationResponse": case "onNavigationResponse":
if ((_webview != null && _webview!.iosOnNavigationResponse != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.iosOnNavigationResponse != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
IOSWKNavigationResponse iosOnNavigationResponse = IOSWKNavigationResponse.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
IOSWKNavigationResponse iosOnNavigationResponse =
IOSWKNavigationResponse.fromMap(arguments)!;
if (_webview != null && _webview!.iosOnNavigationResponse != null) if (_webview != null && _webview!.iosOnNavigationResponse != null)
return (await _webview!.iosOnNavigationResponse!( return (await _webview!.iosOnNavigationResponse!(
this, iosOnNavigationResponse)) this, iosOnNavigationResponse))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser! return (await _inAppBrowser!
.iosOnNavigationResponse(iosOnNavigationResponse)) .iosOnNavigationResponse(iosOnNavigationResponse))
?.toMap(); ?.toMap();
} }
break; break;
case "shouldAllowDeprecatedTLS": case "shouldAllowDeprecatedTLS":
if ((_webview != null && _webview!.iosShouldAllowDeprecatedTLS != null) || _inAppBrowser != null) { if ((_webview != null &&
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _webview!.iosShouldAllowDeprecatedTLS != null) ||
URLAuthenticationChallenge challenge = URLAuthenticationChallenge.fromMap(arguments)!; _inAppBrowser != null) {
Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
URLAuthenticationChallenge challenge =
URLAuthenticationChallenge.fromMap(arguments)!;
if (_webview != null && _webview!.iosShouldAllowDeprecatedTLS != null) if (_webview != null && _webview!.iosShouldAllowDeprecatedTLS != null)
return (await _webview!.iosShouldAllowDeprecatedTLS!( return (await _webview!.iosShouldAllowDeprecatedTLS!(
this, challenge)) this, challenge))
?.toMap(); ?.toMap();
else else
return (await _inAppBrowser! return (await _inAppBrowser!.iosShouldAllowDeprecatedTLS(challenge))
.iosShouldAllowDeprecatedTLS(challenge))
?.toMap(); ?.toMap();
} }
break; break;
case "onLongPressHitTestResult": case "onLongPressHitTestResult":
if ((_webview != null && _webview!.onLongPressHitTestResult != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLongPressHitTestResult != null) ||
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); _inAppBrowser != null) {
InAppWebViewHitTestResult hitTestResult = InAppWebViewHitTestResult.fromMap(arguments)!; Map<String, dynamic> arguments =
call.arguments.cast<String, dynamic>();
InAppWebViewHitTestResult hitTestResult =
InAppWebViewHitTestResult.fromMap(arguments)!;
if (_webview != null && _webview!.onLongPressHitTestResult != null) if (_webview != null && _webview!.onLongPressHitTestResult != null)
_webview!.onLongPressHitTestResult!(this, hitTestResult); _webview!.onLongPressHitTestResult!(this, hitTestResult);
@ -566,13 +672,16 @@ class InAppWebViewController {
ContextMenu? contextMenu; ContextMenu? contextMenu;
if (_webview != null && _webview!.contextMenu != null) { if (_webview != null && _webview!.contextMenu != null) {
contextMenu = _webview!.contextMenu; contextMenu = _webview!.contextMenu;
} else if (_inAppBrowser != null && _inAppBrowser!.contextMenu != null) { } else if (_inAppBrowser != null &&
_inAppBrowser!.contextMenu != null) {
contextMenu = _inAppBrowser!.contextMenu; contextMenu = _inAppBrowser!.contextMenu;
} }
if (contextMenu != null && contextMenu.onCreateContextMenu != null) { if (contextMenu != null && contextMenu.onCreateContextMenu != null) {
Map<String, dynamic> arguments = call.arguments.cast<String, dynamic>(); Map<String, dynamic> arguments =
InAppWebViewHitTestResult hitTestResult = InAppWebViewHitTestResult.fromMap(arguments)!; call.arguments.cast<String, dynamic>();
InAppWebViewHitTestResult hitTestResult =
InAppWebViewHitTestResult.fromMap(arguments)!;
contextMenu.onCreateContextMenu!(hitTestResult); contextMenu.onCreateContextMenu!(hitTestResult);
} }
@ -581,7 +690,8 @@ class InAppWebViewController {
ContextMenu? contextMenu; ContextMenu? contextMenu;
if (_webview != null && _webview!.contextMenu != null) { if (_webview != null && _webview!.contextMenu != null) {
contextMenu = _webview!.contextMenu; contextMenu = _webview!.contextMenu;
} else if (_inAppBrowser != null && _inAppBrowser!.contextMenu != null) { } else if (_inAppBrowser != null &&
_inAppBrowser!.contextMenu != null) {
contextMenu = _inAppBrowser!.contextMenu; contextMenu = _inAppBrowser!.contextMenu;
} }
@ -593,7 +703,8 @@ class InAppWebViewController {
ContextMenu? contextMenu; ContextMenu? contextMenu;
if (_webview != null && _webview!.contextMenu != null) { if (_webview != null && _webview!.contextMenu != null) {
contextMenu = _webview!.contextMenu; contextMenu = _webview!.contextMenu;
} else if (_inAppBrowser != null && _inAppBrowser!.contextMenu != null) { } else if (_inAppBrowser != null &&
_inAppBrowser!.contextMenu != null) {
contextMenu = _inAppBrowser!.contextMenu; contextMenu = _inAppBrowser!.contextMenu;
} }
@ -606,8 +717,10 @@ class InAppWebViewController {
androidId: androidId, iosId: iosId, title: title, action: null); androidId: androidId, iosId: iosId, title: title, action: null);
for (var menuItem in contextMenu.menuItems) { for (var menuItem in contextMenu.menuItems) {
if ((defaultTargetPlatform == TargetPlatform.android && menuItem.androidId == androidId) || if ((defaultTargetPlatform == TargetPlatform.android &&
(defaultTargetPlatform == TargetPlatform.iOS && menuItem.iosId == iosId)) { menuItem.androidId == androidId) ||
(defaultTargetPlatform == TargetPlatform.iOS &&
menuItem.iosId == iosId)) {
menuItemClicked = menuItem; menuItemClicked = menuItem;
if (menuItem.action != null) { if (menuItem.action != null) {
menuItem.action!(); menuItem.action!();
@ -638,7 +751,8 @@ class InAppWebViewController {
switch (handlerName) { switch (handlerName) {
case "onLoadResource": case "onLoadResource":
if ((_webview != null && _webview!.onLoadResource != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onLoadResource != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = args[0].cast<String, dynamic>(); Map<String, dynamic> arguments = args[0].cast<String, dynamic>();
arguments["startTime"] = arguments["startTime"] is int arguments["startTime"] = arguments["startTime"] is int
? arguments["startTime"].toDouble() ? arguments["startTime"].toDouble()
@ -656,11 +770,14 @@ class InAppWebViewController {
} }
return null; return null;
case "shouldInterceptAjaxRequest": case "shouldInterceptAjaxRequest":
if ((_webview != null && _webview!.shouldInterceptAjaxRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.shouldInterceptAjaxRequest != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = args[0].cast<String, dynamic>(); Map<String, dynamic> arguments = args[0].cast<String, dynamic>();
AjaxRequest request = AjaxRequest.fromMap(arguments)!; AjaxRequest request = AjaxRequest.fromMap(arguments)!;
if (_webview != null && _webview!.shouldInterceptAjaxRequest != null) if (_webview != null &&
_webview!.shouldInterceptAjaxRequest != null)
return jsonEncode( return jsonEncode(
await _webview!.shouldInterceptAjaxRequest!(this, request)); await _webview!.shouldInterceptAjaxRequest!(this, request));
else else
@ -669,7 +786,9 @@ class InAppWebViewController {
} }
return null; return null;
case "onAjaxReadyStateChange": case "onAjaxReadyStateChange":
if ((_webview != null && _webview!.onAjaxReadyStateChange != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.onAjaxReadyStateChange != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = args[0].cast<String, dynamic>(); Map<String, dynamic> arguments = args[0].cast<String, dynamic>();
AjaxRequest request = AjaxRequest.fromMap(arguments)!; AjaxRequest request = AjaxRequest.fromMap(arguments)!;
@ -682,31 +801,37 @@ class InAppWebViewController {
} }
return null; return null;
case "onAjaxProgress": case "onAjaxProgress":
if ((_webview != null && _webview!.onAjaxProgress != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onAjaxProgress != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = args[0].cast<String, dynamic>(); Map<String, dynamic> arguments = args[0].cast<String, dynamic>();
AjaxRequest request = AjaxRequest.fromMap(arguments)!; AjaxRequest request = AjaxRequest.fromMap(arguments)!;
if (_webview != null && _webview!.onAjaxProgress != null) if (_webview != null && _webview!.onAjaxProgress != null)
return jsonEncode(await _webview!.onAjaxProgress!(this, request)); return jsonEncode(
await _webview!.onAjaxProgress!(this, request));
else else
return jsonEncode(await _inAppBrowser!.onAjaxProgress(request)); return jsonEncode(await _inAppBrowser!.onAjaxProgress(request));
} }
return null; return null;
case "shouldInterceptFetchRequest": case "shouldInterceptFetchRequest":
if ((_webview != null && _webview!.shouldInterceptFetchRequest != null) || _inAppBrowser != null) { if ((_webview != null &&
_webview!.shouldInterceptFetchRequest != null) ||
_inAppBrowser != null) {
Map<String, dynamic> arguments = args[0].cast<String, dynamic>(); Map<String, dynamic> arguments = args[0].cast<String, dynamic>();
FetchRequest request = FetchRequest.fromMap(arguments)!; FetchRequest request = FetchRequest.fromMap(arguments)!;
if (_webview != null && _webview!.shouldInterceptFetchRequest != null) if (_webview != null &&
return jsonEncode( _webview!.shouldInterceptFetchRequest != null)
await _webview!.shouldInterceptFetchRequest!(this, request)); return jsonEncode(await _webview!.shouldInterceptFetchRequest!(
this, request));
else else
return jsonEncode( return jsonEncode(
await _inAppBrowser!.shouldInterceptFetchRequest(request)); await _inAppBrowser!.shouldInterceptFetchRequest(request));
} }
return null; return null;
case "onPrint": case "onPrint":
if ((_webview != null && _webview!.onPrint != null) || _inAppBrowser != null) { if ((_webview != null && _webview!.onPrint != null) ||
_inAppBrowser != null) {
String? url = args[0]; String? url = args[0];
Uri? uri = url != null ? Uri.parse(url) : null; Uri? uri = url != null ? Uri.parse(url) : null;
if (_webview != null && _webview!.onPrint != null) if (_webview != null && _webview!.onPrint != null)
@ -785,8 +910,7 @@ class InAppWebViewController {
String? html; String? html;
InAppWebViewGroupOptions? options = await getOptions(); InAppWebViewGroupOptions? options = await getOptions();
if (options != null && if (options != null && options.crossPlatform.javaScriptEnabled == true) {
options.crossPlatform.javaScriptEnabled == true) {
html = await evaluateJavascript( html = await evaluateJavascript(
source: "window.document.getElementsByTagName('html')[0].outerHTML;"); source: "window.document.getElementsByTagName('html')[0].outerHTML;");
if (html != null && html.isNotEmpty) return html; if (html != null && html.isNotEmpty) return html;
@ -809,7 +933,7 @@ class InAppWebViewController {
try { try {
var htmlRequest = await client.getUrl(webviewUrl); var htmlRequest = await client.getUrl(webviewUrl);
html = html =
await (await htmlRequest.close()).transform(Utf8Decoder()).join(); await (await htmlRequest.close()).transform(Utf8Decoder()).join();
} catch (e) { } catch (e) {
print(e); print(e);
} }
@ -843,8 +967,7 @@ class InAppWebViewController {
} }
InAppWebViewGroupOptions? options = await getOptions(); InAppWebViewGroupOptions? options = await getOptions();
if (options != null && if (options != null && options.crossPlatform.javaScriptEnabled == true) {
options.crossPlatform.javaScriptEnabled == true) {
List<Map<dynamic, dynamic>> links = (await evaluateJavascript(source: """ List<Map<dynamic, dynamic>> links = (await evaluateJavascript(source: """
(function() { (function() {
var linkNodes = document.head.getElementsByTagName("link"); var linkNodes = document.head.getElementsByTagName("link");
@ -893,7 +1016,8 @@ class InAppWebViewController {
// try to get /favicon.ico // try to get /favicon.ico
try { try {
var faviconUrl = webviewUrl.scheme + "://" + webviewUrl.host + "/favicon.ico"; var faviconUrl =
webviewUrl.scheme + "://" + webviewUrl.host + "/favicon.ico";
var faviconUri = Uri.parse(faviconUrl); var faviconUri = Uri.parse(faviconUrl);
await client.headUrl(faviconUri); await client.headUrl(faviconUri);
favicons.add(Favicon(url: faviconUri, rel: "shortcut icon")); favicons.add(Favicon(url: faviconUri, rel: "shortcut icon"));
@ -907,7 +1031,8 @@ class InAppWebViewController {
HttpClientResponse? manifestResponse; HttpClientResponse? manifestResponse;
bool manifestFound = false; bool manifestFound = false;
if (manifestUrl == null) { if (manifestUrl == null) {
manifestUrl = webviewUrl.scheme + "://" + webviewUrl.host + "/manifest.json"; manifestUrl =
webviewUrl.scheme + "://" + webviewUrl.host + "/manifest.json";
} }
try { try {
manifestRequest = await client.getUrl(Uri.parse(manifestUrl)); manifestRequest = await client.getUrl(Uri.parse(manifestUrl));
@ -924,8 +1049,8 @@ class InAppWebViewController {
json.decode(await manifestResponse!.transform(Utf8Decoder()).join()); json.decode(await manifestResponse!.transform(Utf8Decoder()).join());
if (manifest.containsKey("icons")) { if (manifest.containsKey("icons")) {
for (Map<String, dynamic> icon in manifest["icons"]) { for (Map<String, dynamic> icon in manifest["icons"]) {
favicons.addAll(_createFavicons(webviewUrl, assetPathBase, icon["src"], favicons.addAll(_createFavicons(webviewUrl, assetPathBase,
icon["rel"], icon["sizes"], true)); icon["src"], icon["rel"], icon["sizes"], true));
} }
} }
} }
@ -964,11 +1089,12 @@ class InAppWebViewController {
for (String size in sizesSplitted) { for (String size in sizesSplitted) {
int width = int.parse(size.split("x")[0]); int width = int.parse(size.split("x")[0]);
int height = int.parse(size.split("x")[1]); int height = int.parse(size.split("x")[1]);
favicons favicons.add(Favicon(
.add(Favicon(url: Uri.parse(urlIcon), rel: rel, width: width, height: height)); url: Uri.parse(urlIcon), rel: rel, width: width, height: height));
} }
} else { } else {
favicons.add(Favicon(url: Uri.parse(urlIcon), rel: rel, width: null, height: null)); favicons.add(Favicon(
url: Uri.parse(urlIcon), rel: rel, width: null, height: null));
} }
return favicons; return favicons;
@ -989,13 +1115,16 @@ class InAppWebViewController {
///**Official iOS API**: ///**Official iOS API**:
///- https://developer.apple.com/documentation/webkit/wkwebview/1414954-load ///- https://developer.apple.com/documentation/webkit/wkwebview/1414954-load
///- if [iosAllowingReadAccessTo] is used, https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl ///- if [iosAllowingReadAccessTo] is used, https://developer.apple.com/documentation/webkit/wkwebview/1414973-loadfileurl
Future<void> loadUrl({required URLRequest urlRequest, Uri? iosAllowingReadAccessTo}) async { Future<void> loadUrl(
{required URLRequest urlRequest, Uri? iosAllowingReadAccessTo}) async {
assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty); assert(urlRequest.url != null && urlRequest.url.toString().isNotEmpty);
assert(iosAllowingReadAccessTo == null || iosAllowingReadAccessTo.isScheme("file")); assert(iosAllowingReadAccessTo == null ||
iosAllowingReadAccessTo.isScheme("file"));
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlRequest', () => urlRequest.toMap()); args.putIfAbsent('urlRequest', () => urlRequest.toMap());
args.putIfAbsent('allowingReadAccessTo', () => iosAllowingReadAccessTo.toString()); args.putIfAbsent(
'allowingReadAccessTo', () => iosAllowingReadAccessTo.toString());
await _channel.invokeMethod('loadUrl', args); await _channel.invokeMethod('loadUrl', args);
} }
@ -1040,7 +1169,8 @@ class InAppWebViewController {
args.putIfAbsent('mimeType', () => mimeType); args.putIfAbsent('mimeType', () => mimeType);
args.putIfAbsent('encoding', () => encoding); args.putIfAbsent('encoding', () => encoding);
args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank"); args.putIfAbsent('baseUrl', () => baseUrl?.toString() ?? "about:blank");
args.putIfAbsent('historyUrl', () => androidHistoryUrl?.toString() ?? "about:blank"); args.putIfAbsent(
'historyUrl', () => androidHistoryUrl?.toString() ?? "about:blank");
await _channel.invokeMethod('loadData', args); await _channel.invokeMethod('loadData', args);
} }
@ -1192,12 +1322,14 @@ class InAppWebViewController {
///**Official iOS API**: ///**Official iOS API**:
///- https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript ///- https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript
///- https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript ///- https://developer.apple.com/documentation/webkit/wkwebview/3656442-evaluatejavascript
Future<dynamic> evaluateJavascript({required String source, ContentWorld? contentWorld}) async { Future<dynamic> evaluateJavascript(
{required String source, ContentWorld? contentWorld}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('source', () => source); args.putIfAbsent('source', () => source);
args.putIfAbsent('contentWorld', () => contentWorld?.toMap()); args.putIfAbsent('contentWorld', () => contentWorld?.toMap());
var data = await _channel.invokeMethod('evaluateJavascript', args); var data = await _channel.invokeMethod('evaluateJavascript', args);
if (data != null && defaultTargetPlatform == TargetPlatform.android) data = json.decode(data); if (data != null && defaultTargetPlatform == TargetPlatform.android)
data = json.decode(data);
return data; return data;
} }
@ -1209,11 +1341,14 @@ class InAppWebViewController {
///because, in these events, the [WebView] is not ready to handle it yet. ///because, in these events, the [WebView] is not ready to handle it yet.
///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events ///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events
///where you know the page is ready "enough". ///where you know the page is ready "enough".
Future<void> injectJavascriptFileFromUrl({required Uri urlFile, ScriptHtmlTagAttributes? scriptHtmlTagAttributes}) async { Future<void> injectJavascriptFileFromUrl(
{required Uri urlFile,
ScriptHtmlTagAttributes? scriptHtmlTagAttributes}) async {
assert(urlFile.toString().isNotEmpty); assert(urlFile.toString().isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlFile', () => urlFile.toString()); args.putIfAbsent('urlFile', () => urlFile.toString());
args.putIfAbsent('scriptHtmlTagAttributes', () => scriptHtmlTagAttributes?.toMap()); args.putIfAbsent(
'scriptHtmlTagAttributes', () => scriptHtmlTagAttributes?.toMap());
await _channel.invokeMethod('injectJavascriptFileFromUrl', args); await _channel.invokeMethod('injectJavascriptFileFromUrl', args);
} }
@ -1249,11 +1384,14 @@ class InAppWebViewController {
///because, in these events, the [WebView] is not ready to handle it yet. ///because, in these events, the [WebView] is not ready to handle it yet.
///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events ///Instead, you should call this method, for example, inside the [WebView.onLoadStop] event or in any other events
///where you know the page is ready "enough". ///where you know the page is ready "enough".
Future<void> injectCSSFileFromUrl({required Uri urlFile, CSSLinkHtmlTagAttributes? cssLinkHtmlTagAttributes}) async { Future<void> injectCSSFileFromUrl(
{required Uri urlFile,
CSSLinkHtmlTagAttributes? cssLinkHtmlTagAttributes}) async {
assert(urlFile.toString().isNotEmpty); assert(urlFile.toString().isNotEmpty);
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlFile', () => urlFile.toString()); args.putIfAbsent('urlFile', () => urlFile.toString());
args.putIfAbsent('cssLinkHtmlTagAttributes', () => cssLinkHtmlTagAttributes?.toMap()); args.putIfAbsent(
'cssLinkHtmlTagAttributes', () => cssLinkHtmlTagAttributes?.toMap());
await _channel.invokeMethod('injectCSSFileFromUrl', args); await _channel.invokeMethod('injectCSSFileFromUrl', args);
} }
@ -1340,9 +1478,11 @@ class InAppWebViewController {
///**NOTE for iOS**: available on iOS 11.0+. ///**NOTE for iOS**: available on iOS 11.0+.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/2873260-takesnapshot
Future<Uint8List?> takeScreenshot({ScreenshotConfiguration? screenshotConfiguration}) async { Future<Uint8List?> takeScreenshot(
{ScreenshotConfiguration? screenshotConfiguration}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('screenshotConfiguration', () => screenshotConfiguration?.toMap()); args.putIfAbsent(
'screenshotConfiguration', () => screenshotConfiguration?.toMap());
return await _channel.invokeMethod('takeScreenshot', args); return await _channel.invokeMethod('takeScreenshot', args);
} }
@ -1378,7 +1518,9 @@ class InAppWebViewController {
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1414977-backforwardlist
Future<WebHistory?> getCopyBackForwardList() async { Future<WebHistory?> getCopyBackForwardList() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
Map<String, dynamic>? result = (await _channel.invokeMethod('getCopyBackForwardList', args))?.cast<String, dynamic>(); Map<String, dynamic>? result =
(await _channel.invokeMethod('getCopyBackForwardList', args))
?.cast<String, dynamic>();
return WebHistory.fromMap(result); return WebHistory.fromMap(result);
} }
@ -1533,9 +1675,12 @@ 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({required double zoomFactor, bool iosAnimated = false}) async { Future<void> zoomBy(
{required double zoomFactor, bool iosAnimated = false}) async {
assert(defaultTargetPlatform != TargetPlatform.android || assert(defaultTargetPlatform != TargetPlatform.android ||
(defaultTargetPlatform == TargetPlatform.android && zoomFactor > 0.01 && zoomFactor <= 100.0)); (defaultTargetPlatform == TargetPlatform.android &&
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);
@ -1723,7 +1868,9 @@ class InAppWebViewController {
var colorValue = metaTagThemeColor.content; var colorValue = metaTagThemeColor.content;
return colorValue != null ? UtilColor.fromStringRepresentation(colorValue) : null; return colorValue != null
? UtilColor.fromStringRepresentation(colorValue)
: null;
} }
///Returns the scrolled left position of the current WebView. ///Returns the scrolled left position of the current WebView.
@ -1832,7 +1979,8 @@ class InAppWebViewController {
///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set. ///**NOTE for iOS**: this method will throw an error if the [WebView.windowId] has been set.
///There isn't any way to add/remove user scripts specific to iOS window WebViews. ///There isn't any way to add/remove user scripts specific to iOS window WebViews.
///This is a limitation of the native iOS WebKit APIs. ///This is a limitation of the native iOS WebKit APIs.
Future<void> removeUserScripts({required List<UserScript> userScripts}) async { Future<void> removeUserScripts(
{required List<UserScript> userScripts}) async {
assert(_webview?.windowId == null || !Platform.isIOS); assert(_webview?.windowId == null || !Platform.isIOS);
for (var i = 0; i < userScripts.length; i++) { for (var i = 0; i < userScripts.length; i++) {
@ -1880,7 +2028,8 @@ class InAppWebViewController {
///**NOTE for Android**: available only on Android 21+. ///**NOTE for Android**: available only on Android 21+.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/3656441-callasyncjavascript
Future<CallAsyncJavaScriptResult?> callAsyncJavaScript({required String functionBody, Future<CallAsyncJavaScriptResult?> callAsyncJavaScript(
{required String functionBody,
Map<String, dynamic> arguments = const <String, dynamic>{}, Map<String, dynamic> arguments = const <String, dynamic>{},
ContentWorld? contentWorld}) async { ContentWorld? contentWorld}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
@ -1894,7 +2043,8 @@ class InAppWebViewController {
if (defaultTargetPlatform == TargetPlatform.android) { if (defaultTargetPlatform == TargetPlatform.android) {
data = json.decode(data); data = json.decode(data);
} }
return CallAsyncJavaScriptResult(value: data["value"], error: data["error"]); return CallAsyncJavaScriptResult(
value: data["value"], error: data["error"]);
} }
///Saves the current WebView as a web archive. ///Saves the current WebView as a web archive.
@ -1919,7 +2069,7 @@ class InAppWebViewController {
assert(filePath.endsWith("." + WebArchiveFormat.WEBARCHIVE.toValue())); assert(filePath.endsWith("." + WebArchiveFormat.WEBARCHIVE.toValue()));
} }
} }
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("filePath", () => filePath); args.putIfAbsent("filePath", () => filePath);
args.putIfAbsent("autoname", () => autoname); args.putIfAbsent("autoname", () => autoname);
@ -1932,8 +2082,7 @@ class InAppWebViewController {
///**NOTE for Android**: available Android 21.0+. ///**NOTE for Android**: available Android 21.0+.
Future<bool> isSecureContext() async { Future<bool> isSecureContext() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel return await _channel.invokeMethod('isSecureContext', args);
.invokeMethod('isSecureContext', args);
} }
///Gets the default user agent. ///Gets the default user agent.
@ -1943,4 +2092,4 @@ class InAppWebViewController {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _staticChannel.invokeMethod('getDefaultUserAgent', args); return await _staticChannel.invokeMethod('getDefaultUserAgent', args);
} }
} }

View File

@ -41,7 +41,10 @@ class InAppWebViewGroupOptions {
///iOS-specific options. ///iOS-specific options.
late IOSInAppWebViewOptions ios; late IOSInAppWebViewOptions ios;
InAppWebViewGroupOptions({InAppWebViewOptions? crossPlatform, AndroidInAppWebViewOptions? android, IOSInAppWebViewOptions? ios}) { InAppWebViewGroupOptions(
{InAppWebViewOptions? crossPlatform,
AndroidInAppWebViewOptions? android,
IOSInAppWebViewOptions? ios}) {
this.crossPlatform = crossPlatform ?? InAppWebViewOptions(); this.crossPlatform = crossPlatform ?? InAppWebViewOptions();
this.android = android ?? AndroidInAppWebViewOptions(); this.android = android ?? AndroidInAppWebViewOptions();
this.ios = ios ?? IOSInAppWebViewOptions(); this.ios = ios ?? IOSInAppWebViewOptions();
@ -52,14 +55,15 @@ class InAppWebViewGroupOptions {
options.addAll(this.crossPlatform.toMap()); options.addAll(this.crossPlatform.toMap());
if (defaultTargetPlatform == TargetPlatform.android) if (defaultTargetPlatform == TargetPlatform.android)
options.addAll(this.android.toMap()); 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; return options;
} }
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);
@ -229,7 +233,8 @@ class InAppWebViewOptions
this.allowFileAccessFromFileURLs = false, this.allowFileAccessFromFileURLs = false,
this.allowUniversalAccessFromFileURLs = false}) { this.allowUniversalAccessFromFileURLs = false}) {
if (this.minimumFontSize == null) if (this.minimumFontSize == null)
this.minimumFontSize = defaultTargetPlatform == TargetPlatform.android ? 8 : 0; this.minimumFontSize =
defaultTargetPlatform == TargetPlatform.android ? 8 : 0;
assert(!this.resourceCustomSchemes.contains("http") && assert(!this.resourceCustomSchemes.contains("http") &&
!this.resourceCustomSchemes.contains("https")); !this.resourceCustomSchemes.contains("https"));
} }
@ -313,7 +318,8 @@ class InAppWebViewOptions
options.disableContextMenu = map["disableContextMenu"]; options.disableContextMenu = map["disableContextMenu"];
options.supportZoom = map["supportZoom"]; options.supportZoom = map["supportZoom"];
options.allowFileAccessFromFileURLs = map["allowFileAccessFromFileURLs"]; options.allowFileAccessFromFileURLs = map["allowFileAccessFromFileURLs"];
options.allowUniversalAccessFromFileURLs = map["allowUniversalAccessFromFileURLs"]; options.allowUniversalAccessFromFileURLs =
map["allowUniversalAccessFromFileURLs"];
return options; return options;
} }

View File

@ -33,9 +33,11 @@ class IOSInAppWebViewController {
///**NOTE**: available only on iOS 14.0+. ///**NOTE**: available only on iOS 14.0+.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/3650490-createpdf
Future<Uint8List?> createPdf({IOSWKPDFConfiguration? iosWKPdfConfiguration}) async { Future<Uint8List?> createPdf(
{IOSWKPDFConfiguration? iosWKPdfConfiguration}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('iosWKPdfConfiguration', () => iosWKPdfConfiguration?.toMap()); args.putIfAbsent(
'iosWKPdfConfiguration', () => iosWKPdfConfiguration?.toMap());
return await _channel.invokeMethod('createPdf', args); return await _channel.invokeMethod('createPdf', args);
} }
@ -55,8 +57,7 @@ class IOSInAppWebViewController {
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkwebview/1415002-hasonlysecurecontent
Future<bool> hasOnlySecureContent() async { Future<bool> hasOnlySecureContent() async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
return await _channel return await _channel.invokeMethod('hasOnlySecureContent', args);
.invokeMethod('hasOnlySecureContent', args);
} }
///Returns a Boolean value that indicates whether WebKit natively supports resources with the specified URL scheme. ///Returns a Boolean value that indicates whether WebKit natively supports resources with the specified URL scheme.
@ -69,7 +70,6 @@ class IOSInAppWebViewController {
static Future<bool> handlesURLScheme(String urlScheme) async { static Future<bool> handlesURLScheme(String urlScheme) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('urlScheme', () => urlScheme); args.putIfAbsent('urlScheme', () => urlScheme);
return await _staticChannel return await _staticChannel.invokeMethod('handlesURLScheme', args);
.invokeMethod('handlesURLScheme', args);
} }
} }

View File

@ -247,7 +247,8 @@ class IOSInAppWebViewOptions
this.applePayAPIEnabled = false, this.applePayAPIEnabled = false,
this.allowingReadAccessTo, this.allowingReadAccessTo,
this.disableLongPressContextMenuOnLinks = false}) { this.disableLongPressContextMenuOnLinks = false}) {
assert(allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file")); assert(
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"));
} }
@override @override
@ -283,7 +284,8 @@ class IOSInAppWebViewOptions
"isPagingEnabled": isPagingEnabled, "isPagingEnabled": isPagingEnabled,
"maximumZoomScale": maximumZoomScale, "maximumZoomScale": maximumZoomScale,
"minimumZoomScale": minimumZoomScale, "minimumZoomScale": minimumZoomScale,
"contentInsetAdjustmentBehavior": contentInsetAdjustmentBehavior.toValue(), "contentInsetAdjustmentBehavior":
contentInsetAdjustmentBehavior.toValue(),
"isDirectionalLockEnabled": isDirectionalLockEnabled, "isDirectionalLockEnabled": isDirectionalLockEnabled,
"mediaType": mediaType, "mediaType": mediaType,
"pageZoom": pageZoom, "pageZoom": pageZoom,
@ -300,7 +302,8 @@ class IOSInAppWebViewOptions
List<String> dataDetectorTypesList = List<String> dataDetectorTypesList =
List<String>.from(map["dataDetectorTypes"] ?? []); List<String>.from(map["dataDetectorTypes"] ?? []);
dataDetectorTypesList.forEach((dataDetectorTypeValue) { dataDetectorTypesList.forEach((dataDetectorTypeValue) {
var dataDetectorType = IOSWKDataDetectorTypes.fromValue(dataDetectorTypeValue); var dataDetectorType =
IOSWKDataDetectorTypes.fromValue(dataDetectorTypeValue);
if (dataDetectorType != null) { if (dataDetectorType != null) {
dataDetectorTypes.add(dataDetectorType); dataDetectorTypes.add(dataDetectorType);
} }
@ -344,11 +347,15 @@ class IOSInAppWebViewOptions
options.isDirectionalLockEnabled = map["isDirectionalLockEnabled"]; options.isDirectionalLockEnabled = map["isDirectionalLockEnabled"];
options.mediaType = map["mediaType"]; options.mediaType = map["mediaType"];
options.pageZoom = map["pageZoom"]; options.pageZoom = map["pageZoom"];
options.limitsNavigationsToAppBoundDomains = map["limitsNavigationsToAppBoundDomains"]; options.limitsNavigationsToAppBoundDomains =
map["limitsNavigationsToAppBoundDomains"];
options.useOnNavigationResponse = map["useOnNavigationResponse"]; options.useOnNavigationResponse = map["useOnNavigationResponse"];
options.applePayAPIEnabled = map["applePayAPIEnabled"]; options.applePayAPIEnabled = map["applePayAPIEnabled"];
options.allowingReadAccessTo = map["allowingReadAccessTo"] != null ? Uri.parse(map["allowingReadAccessTo"]) : null; options.allowingReadAccessTo = map["allowingReadAccessTo"] != null
options.disableLongPressContextMenuOnLinks = map["disableLongPressContextMenuOnLinks"]; ? Uri.parse(map["allowingReadAccessTo"])
: null;
options.disableLongPressContextMenuOnLinks =
map["disableLongPressContextMenuOnLinks"];
return options; return options;
} }

View File

@ -1,2 +1,2 @@
export 'in_app_webview_options.dart'; export 'in_app_webview_options.dart';
export 'in_app_webview_controller.dart'; export 'in_app_webview_controller.dart';

View File

@ -4,4 +4,4 @@ export 'in_app_webview_controller.dart';
export 'in_app_webview_options.dart'; export 'in_app_webview_options.dart';
export 'headless_in_app_webview.dart'; export 'headless_in_app_webview.dart';
export 'android/main.dart'; export 'android/main.dart';
export 'ios/main.dart'; export 'ios/main.dart';

View File

@ -21,8 +21,7 @@ abstract class WebView {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap)
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview
final void Function(InAppWebViewController controller, Uri? url)? final void Function(InAppWebViewController controller, Uri? url)? onLoadStart;
onLoadStart;
///Event fired when the [WebView] finishes loading an [url]. ///Event fired when the [WebView] finishes loading an [url].
/// ///
@ -126,8 +125,7 @@ abstract class WebView {
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wkurlschemehandler
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
InAppWebViewController controller, Uri url)? InAppWebViewController controller, Uri url)? onLoadResourceCustomScheme;
onLoadResourceCustomScheme;
///Event fired when the [WebView] requests the host application to create a new window, ///Event fired when the [WebView] requests the host application to create a new window,
///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side. ///for example when trying to open a link with `target="_blank"` or when `window.open()` is called by JavaScript side.
@ -221,9 +219,8 @@ abstract class WebView {
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedHttpAuthRequest(android.webkit.WebView,%20android.webkit.HttpAuthHandler,%20java.lang.String,%20java.lang.String)
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview
final Future<HttpAuthResponse?> Function( final Future<HttpAuthResponse?> Function(InAppWebViewController controller,
InAppWebViewController controller, HttpAuthenticationChallenge challenge)? HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
onReceivedHttpAuthRequest;
///Event fired when the WebView need to perform server trust authentication (certificate validation). ///Event fired when the WebView need to perform server trust authentication (certificate validation).
///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED]. ///The host application must return either [ServerTrustAuthResponse] instance with [ServerTrustAuthResponseAction.CANCEL] or [ServerTrustAuthResponseAction.PROCEED].
@ -396,8 +393,10 @@ abstract class WebView {
///**NOTE**: available only on Android 27+. ///**NOTE**: available only on Android 27+.
/// ///
///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse) ///**Official Android API**: https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)
final Future<SafeBrowsingResponse?> Function(InAppWebViewController controller, final Future<SafeBrowsingResponse?> Function(
Uri url, SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit; InAppWebViewController controller,
Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
///Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied. ///Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied.
/// ///
@ -602,9 +601,9 @@ abstract class WebView {
/// ///
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview
final Future<IOSNavigationResponseAction?> Function(InAppWebViewController controller, final Future<IOSNavigationResponseAction?> Function(
IOSWKNavigationResponse navigationResponse)? InAppWebViewController controller,
iosOnNavigationResponse; IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1). ///Called when a web view asks whether to continue with a connection that uses a deprecated version of TLS (v1.0 and v1.1).
/// ///
@ -613,9 +612,9 @@ abstract class WebView {
///**NOTE**: available only on iOS 14.0+. ///**NOTE**: available only on iOS 14.0+.
/// ///
///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview ///**Official iOS API**: https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview
final Future<IOSShouldAllowDeprecatedTLSAction?> Function(InAppWebViewController controller, final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
URLAuthenticationChallenge challenge)? InAppWebViewController controller,
iosShouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
///Initial url request that will be loaded. ///Initial url request that will be loaded.
/// ///

View File

@ -0,0 +1 @@

View File

@ -13,4 +13,4 @@ export 'cookie_manager.dart';
export 'in_app_localhost_server.dart'; export 'in_app_localhost_server.dart';
export 'content_blocker.dart'; export 'content_blocker.dart';
export 'http_auth_credentials_database.dart'; export 'http_auth_credentials_database.dart';
export 'context_menu.dart'; export 'context_menu.dart';

File diff suppressed because it is too large Load Diff

View File

@ -449,4 +449,4 @@ extension HexColor on Color {
'${red.toRadixString(16).padLeft(2, '0')}' '${red.toRadixString(16).padLeft(2, '0')}'
'${green.toRadixString(16).padLeft(2, '0')}' '${green.toRadixString(16).padLeft(2, '0')}'
'${blue.toRadixString(16).padLeft(2, '0')}'; '${blue.toRadixString(16).padLeft(2, '0')}';
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
const WEB_STORAGE_STATIC_CHANNEL = const MethodChannel('com.pichillilorenzo/flutter_inappwebview_webstoragemanager'); const WEB_STORAGE_STATIC_CHANNEL = const MethodChannel(
'com.pichillilorenzo/flutter_inappwebview_webstoragemanager');

View File

@ -1 +1 @@
export 'web_storage_manager.dart'; export 'web_storage_manager.dart';

View File

@ -50,8 +50,7 @@ class AndroidWebStorageManager {
Future<int> getQuotaForOrigin({required String origin}) async { Future<int> getQuotaForOrigin({required String origin}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("origin", () => origin); args.putIfAbsent("origin", () => origin);
return await _staticChannel return await _staticChannel.invokeMethod('getQuotaForOrigin', args);
.invokeMethod('getQuotaForOrigin', args);
} }
///Gets the amount of storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin]. ///Gets the amount of storage currently being used by both the Application Cache and Web SQL Database APIs by the given [origin].
@ -59,7 +58,6 @@ class AndroidWebStorageManager {
Future<int> getUsageForOrigin({required String origin}) async { Future<int> getUsageForOrigin({required String origin}) async {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("origin", () => origin); args.putIfAbsent("origin", () => origin);
return await _staticChannel return await _staticChannel.invokeMethod('getUsageForOrigin', args);
.invokeMethod('getUsageForOrigin', args);
} }
} }

View File

@ -1 +1 @@
export 'web_storage_manager.dart'; export 'web_storage_manager.dart';

View File

@ -24,9 +24,9 @@ class IOSWebStorageManager {
} }
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("dataTypes", () => dataTypesList); args.putIfAbsent("dataTypes", () => dataTypesList);
List<Map<dynamic, dynamic>> records = (await _staticChannel List<Map<dynamic, dynamic>> records =
.invokeMethod('fetchDataRecords', args)) (await _staticChannel.invokeMethod('fetchDataRecords', args))
.cast<Map<dynamic, dynamic>>(); .cast<Map<dynamic, dynamic>>();
for (var record in records) { for (var record in records) {
List<String> dataTypesString = record["dataTypes"].cast<String>(); List<String> dataTypesString = record["dataTypes"].cast<String>();
Set<IOSWKWebsiteDataType> dataTypes = Set(); Set<IOSWKWebsiteDataType> dataTypes = Set();
@ -84,7 +84,6 @@ class IOSWebStorageManager {
Map<String, dynamic> args = <String, dynamic>{}; Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("dataTypes", () => dataTypesList); args.putIfAbsent("dataTypes", () => dataTypesList);
args.putIfAbsent("timestamp", () => timestamp); args.putIfAbsent("timestamp", () => timestamp);
await _staticChannel await _staticChannel.invokeMethod('removeDataModifiedSince', args);
.invokeMethod('removeDataModifiedSince', args);
} }
} }

View File

@ -1,4 +1,4 @@
export 'web_storage.dart'; export 'web_storage.dart';
export 'web_storage_manager.dart'; export 'web_storage_manager.dart';
export 'android/main.dart'; export 'android/main.dart';
export 'ios/main.dart'; export 'ios/main.dart';

View File

@ -30,4 +30,4 @@ class WebStorageManager {
} }
static Future<dynamic> _handleMethod(MethodCall call) async {} static Future<dynamic> _handleMethod(MethodCall call) async {}
} }

View File

@ -2,26 +2,25 @@ import 'dart:typed_data';
import 'asn1_identifier.dart'; import 'asn1_identifier.dart';
class ASN1DEREncoder { class ASN1DEREncoder {
static Uint8List encodeSequence({required Uint8List content}) {
var encoded = Uint8List.fromList([]);
encoded.add(ASN1Identifier.constructedTag |
ASN1IdentifierTagNumber.SEQUENCE.toValue());
encoded.addAll(contentLength(size: content.length));
encoded.addAll(content);
return Uint8List.fromList(encoded);
}
static Uint8List encodeSequence({required Uint8List content}) { static Uint8List contentLength({required int size}) {
var encoded = Uint8List.fromList([]); if (size >= 128) {
encoded.add(ASN1Identifier.constructedTag | ASN1IdentifierTagNumber.SEQUENCE.toValue()); var lenBytes = Uint8List(size);
encoded.addAll(contentLength(size: content.length)); while (lenBytes.first == 0) {
encoded.addAll(content); lenBytes.removeAt(0);
return Uint8List.fromList(encoded); }
int len = 0x80 | lenBytes.length;
return Uint8List(len)..addAll(lenBytes);
} else {
return Uint8List(size);
} }
}
static Uint8List contentLength({required int size}) {
if (size >= 128) {
var lenBytes = Uint8List(size);
while (lenBytes.first == 0) {
lenBytes.removeAt(0);
}
int len = 0x80 | lenBytes.length;
return Uint8List(len)..addAll(lenBytes);
} else {
return Uint8List(size);
}
}
} }

View File

@ -97,12 +97,12 @@ class ASN1DistinguishedNames {
} }
static String quote(String string) { static String quote(String string) {
var specialChars = [",", "+", "=", "\n", "<", ">", "#", ";", "\\"]; var specialChars = [",", "+", "=", "\n", "<", ">", "#", ";", "\\"];
for (var specialChar in specialChars) { for (var specialChar in specialChars) {
if (string.contains(specialChar)) { if (string.contains(specialChar)) {
return "\"" + string + "\""; return "\"" + string + "\"";
}
} }
return string; }
return string;
} }
} }

View File

@ -13,8 +13,8 @@ class ASN1IdentifierClass {
static ASN1IdentifierClass? fromValue(int? value) { static ASN1IdentifierClass? fromValue(int? value) {
if (value != null) { if (value != null) {
try { try {
return ASN1IdentifierClass.values.firstWhere( return ASN1IdentifierClass.values
(element) => element.toValue() == value); .firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; return null;
} }
@ -90,8 +90,8 @@ class ASN1IdentifierTagNumber {
static ASN1IdentifierTagNumber? fromValue(int? value) { static ASN1IdentifierTagNumber? fromValue(int? value) {
if (value != null) { if (value != null) {
try { try {
return ASN1IdentifierTagNumber.values.firstWhere( return ASN1IdentifierTagNumber.values
(element) => element.toValue() == value); .firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; return null;
} }

View File

@ -18,7 +18,8 @@ class KeyUsage {
static KeyUsage? fromIndex(int? value) { static KeyUsage? fromIndex(int? value) {
if (value != null) { if (value != null) {
try { try {
return KeyUsage.values.firstWhere((element) => element.toValue() == value); return KeyUsage.values
.firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; return null;
} }
@ -28,7 +29,9 @@ class KeyUsage {
int toValue() => _value; int toValue() => _value;
String name() => _KeyUsageMapName.containsKey(this._value) ? _KeyUsageMapName[this._value]! : ""; String name() => _KeyUsageMapName.containsKey(this._value)
? _KeyUsageMapName[this._value]!
: "";
@override @override
String toString() => "($_value, ${name()})"; String toString() => "($_value, ${name()})";

View File

@ -9,4 +9,4 @@ export 'key_usage.dart';
export 'x509_certificate.dart'; export 'x509_certificate.dart';
export 'x509_extension.dart'; export 'x509_extension.dart';
export 'x509_public_key.dart'; export 'x509_public_key.dart';
export 'asn1_der_encoder.dart'; export 'asn1_der_encoder.dart';

View File

@ -120,7 +120,8 @@ class OID {
String toValue() => _value; String toValue() => _value;
String name() => _oidMapName.containsKey(this._value) ? _oidMapName[this._value]! : ""; String name() =>
_oidMapName.containsKey(this._value) ? _oidMapName[this._value]! : "";
@override @override
String toString() => "($_value, ${name()})"; String toString() => "($_value, ${name()})";

View File

@ -96,7 +96,9 @@ class X509Certificate {
} }
String get description => String get description =>
asn1?.fold("", (value, element) => (value ?? '') + element.description + '\n') ?? ''; asn1?.fold(
"", (value, element) => (value ?? '') + element.description + '\n') ??
'';
///Checks that the given date is within the certificate's validity period. ///Checks that the given date is within the certificate's validity period.
bool checkValidity({DateTime? date}) { bool checkValidity({DateTime? date}) {
@ -222,20 +224,22 @@ class X509Certificate {
///Gets the notAfter date from the validity period of the certificate. ///Gets the notAfter date from the validity period of the certificate.
DateTime? get notAfter { DateTime? get notAfter {
var value = block1?.atIndex(X509BlockPosition.dateValidity) var value = block1
?.atIndex(X509BlockPosition.dateValidity)
?.subAtIndex(1) ?.subAtIndex(1)
?.value as DateTime?; ?.value as DateTime?;
return value; return value;
} }
///Gets the signature value (the raw signature bits) from the certificate. ///Gets the signature value (the raw signature bits) from the certificate.
List<int>? get signature => asn1?[0].subAtIndex(2)?.value as List<int>; List<int>? get signature => asn1?[0].subAtIndex(2)?.value as List<int>;
///Gets the signature algorithm name for the certificate signature algorithm. ///Gets the signature algorithm name for the certificate signature algorithm.
String? get sigAlgName => OID.fromValue(sigAlgOID ?? '')?.name(); String? get sigAlgName => OID.fromValue(sigAlgOID ?? '')?.name();
///Gets the signature algorithm OID string from the certificate. ///Gets the signature algorithm OID string from the certificate.
String? get sigAlgOID => block1?.subAtIndex(2)?.subAtIndex(0)?.value as String?; String? get sigAlgOID =>
block1?.subAtIndex(2)?.subAtIndex(0)?.value as String?;
///Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm. ///Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm.
List<int>? get sigAlgParams => null; List<int>? get sigAlgParams => null;
@ -278,11 +282,13 @@ class X509Certificate {
///Gets a collection of subject alternative names from the SubjectAltName extension, (OID = 2.5.29.17). ///Gets a collection of subject alternative names from the SubjectAltName extension, (OID = 2.5.29.17).
List<String> get subjectAlternativeNames => List<String> get subjectAlternativeNames =>
extensionObject(oid: OID.subjectAltName)?.alternativeNameAsStrings ?? <String>[]; extensionObject(oid: OID.subjectAltName)?.alternativeNameAsStrings ??
<String>[];
///Gets a collection of issuer alternative names from the IssuerAltName extension, (OID = 2.5.29.18). ///Gets a collection of issuer alternative names from the IssuerAltName extension, (OID = 2.5.29.18).
List<String> get issuerAlternativeNames => List<String> get issuerAlternativeNames =>
extensionObject(oid: OID.issuerAltName)?.alternativeNameAsStrings ?? <String>[]; extensionObject(oid: OID.issuerAltName)?.alternativeNameAsStrings ??
<String>[];
///Gets the informations of the public key from this certificate. ///Gets the informations of the public key from this certificate.
X509PublicKey? get publicKey { X509PublicKey? get publicKey {
@ -321,24 +327,35 @@ 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).
BasicConstraintExtension? get basicConstraints => extensionObject(oid: OID.basicConstraints) as BasicConstraintExtension?; BasicConstraintExtension? get basicConstraints =>
extensionObject(oid: OID.basicConstraints) as BasicConstraintExtension?;
///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).
SubjectKeyIdentifierExtension? get subjectKeyIdentifier => extensionObject(oid: OID.subjectKeyIdentifier) as SubjectKeyIdentifierExtension?; SubjectKeyIdentifierExtension? get subjectKeyIdentifier =>
extensionObject(oid: OID.subjectKeyIdentifier)
as SubjectKeyIdentifierExtension?;
///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).
AuthorityKeyIdentifierExtension? get authorityKeyIdentifier => extensionObject(oid: OID.authorityKeyIdentifier) as AuthorityKeyIdentifierExtension?; AuthorityKeyIdentifierExtension? get authorityKeyIdentifier =>
extensionObject(oid: OID.authorityKeyIdentifier)
as AuthorityKeyIdentifierExtension?;
///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).
CertificatePoliciesExtension? get certificatePolicies => extensionObject(oid: OID.certificatePolicies) as CertificatePoliciesExtension?; CertificatePoliciesExtension? get certificatePolicies =>
extensionObject(oid: OID.certificatePolicies)
as CertificatePoliciesExtension?;
///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).
CRLDistributionPointsExtension? get cRLDistributionPoints => extensionObject(oid: OID.cRLDistributionPoints) as CRLDistributionPointsExtension?; CRLDistributionPointsExtension? get cRLDistributionPoints =>
extensionObject(oid: OID.cRLDistributionPoints)
as CRLDistributionPointsExtension?;
///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).
AuthorityInfoAccessExtension? get authorityInfoAccess => extensionObject(oid: OID.authorityInfoAccess) as AuthorityInfoAccessExtension?; AuthorityInfoAccessExtension? get authorityInfoAccess =>
extensionObject(oid: OID.authorityInfoAccess)
as AuthorityInfoAccessExtension?;
List<ASN1Object>? get extensionBlocks => List<ASN1Object>? get extensionBlocks =>
block1?.atIndex(X509BlockPosition.extensions)?.subAtIndex(0)?.sub; block1?.atIndex(X509BlockPosition.extensions)?.subAtIndex(0)?.sub;
@ -349,7 +366,8 @@ class X509Certificate {
oidValue = oid.toValue(); oidValue = oid.toValue();
} }
if (oidValue != null) { if (oidValue != null) {
var block = block1?.atIndex(X509BlockPosition.extensions) var block = block1
?.atIndex(X509BlockPosition.extensions)
?.findOid(oidValue: oidValue) ?.findOid(oidValue: oidValue)
?.parent; ?.parent;
if (block != null) { if (block != null) {

View File

@ -87,7 +87,7 @@ class X509Extension {
for (var item in sub) { for (var item in sub) {
var name = generalName(item: item); var name = generalName(item: item);
if (name != null) { if (name != null) {
result.add(name); result.add(name);
} }
} }
return result; return result;
@ -139,7 +139,8 @@ class X509Extension {
class BasicConstraintExtension extends X509Extension { class BasicConstraintExtension extends X509Extension {
BasicConstraintExtension({required block}) : super(block: block); BasicConstraintExtension({required block}) : super(block: block);
bool get isCA => valueAsBlock?.subAtIndex(0)?.subAtIndex(0)?.value as bool? ?? false; bool get isCA =>
valueAsBlock?.subAtIndex(0)?.subAtIndex(0)?.value as bool? ?? false;
int? get pathLenConstraint { int? get pathLenConstraint {
var data = valueAsBlock?.subAtIndex(0)?.subAtIndex(0)?.value as List<int>?; var data = valueAsBlock?.subAtIndex(0)?.subAtIndex(0)?.value as List<int>?;
@ -270,11 +271,12 @@ class AuthorityKeyIdentifierExtension extends X509Extension {
List<int>? get keyIdentifier { List<int>? get keyIdentifier {
var sequence = valueAsBlock?.subAtIndex(0)?.sub; var sequence = valueAsBlock?.subAtIndex(0)?.sub;
if (sequence == null) { if (sequence == null) {
return null; return null;
} }
ASN1Object? sub; ASN1Object? sub;
try { try {
sub = sequence.firstWhere((element) => element.identifier?.tagNumber().toValue() == 0); sub = sequence.firstWhere(
(element) => element.identifier?.tagNumber().toValue() == 0);
return sub.encoded; return sub.encoded;
} catch (e) {} } catch (e) {}
return null; return null;
@ -287,7 +289,8 @@ class AuthorityKeyIdentifierExtension extends X509Extension {
} }
ASN1Object? sub; ASN1Object? sub;
try { try {
sub = sequence.firstWhere((element) => element.identifier?.tagNumber().toValue() == 1); sub = sequence.firstWhere(
(element) => element.identifier?.tagNumber().toValue() == 1);
List<String>? result; List<String>? result;
if (sub.sub != null) { if (sub.sub != null) {
result = <String>[]; result = <String>[];
@ -310,7 +313,8 @@ class AuthorityKeyIdentifierExtension extends X509Extension {
} }
ASN1Object? sub; ASN1Object? sub;
try { try {
sub = sequence.firstWhere((element) => element.identifier?.tagNumber().toValue() == 2); sub = sequence.firstWhere(
(element) => element.identifier?.tagNumber().toValue() == 2);
return sub.encoded; return sub.encoded;
} catch (e) {} } catch (e) {}
return null; return null;
@ -356,6 +360,7 @@ class CertificatePolicyQualifier {
return toMap(); return toMap();
} }
} }
class CertificatePolicy { class CertificatePolicy {
String oid; String oid;
List<CertificatePolicyQualifier>? qualifiers; List<CertificatePolicyQualifier>? qualifiers;
@ -472,4 +477,4 @@ class CRLDistributionPointsExtension extends X509Extension {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return toMap(); return toMap();
} }
} }

View File

@ -10,9 +10,9 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
uuid: ^3.0.0-nullsafety.0 uuid: ^3.0.0-nullsafety.1
mime: ^1.0.0-nullsafety.0 mime: ^1.0.0
intl: ^0.17.0-nullsafety.2 intl: ^0.17.0
device_info: ^2.0.0-nullsafety.2 device_info: ^2.0.0-nullsafety.2
dev_dependencies: dev_dependencies: