updated chrome_safari_browser implementation, updated WebMessage.ports interface, updated WebViewAssetLoader implementation, force InAppWebViewController type for webview controller events

This commit is contained in:
Lorenzo Pichilli 2023-11-23 16:01:14 +01:00
parent d37de77f36
commit 9cb8b3af26
111 changed files with 2914 additions and 2337 deletions

View File

@ -214,12 +214,12 @@ void customTabs() {
}); });
skippableTest('getMaxToolbarItems', () async { skippableTest('getMaxToolbarItems', () async {
expect(await PlatformChromeSafariBrowser.getMaxToolbarItems(), expect(await ChromeSafariBrowser.getMaxToolbarItems(),
greaterThanOrEqualTo(0)); greaterThanOrEqualTo(0));
}); });
skippableTest('getPackageName', () async { skippableTest('getPackageName', () async {
expect(await PlatformChromeSafariBrowser.getPackageName(), isNotNull); expect(await ChromeSafariBrowser.getPackageName(), isNotNull);
}); });
}, skip: shouldSkip); }, skip: shouldSkip);
} }

View File

@ -32,10 +32,10 @@ void sfSafariViewController() {
skippableTest('create and invalidate Prewarming Token', () async { skippableTest('create and invalidate Prewarming Token', () async {
final prewarmingToken = final prewarmingToken =
await PlatformChromeSafariBrowser.prewarmConnections([TEST_URL_1]); await ChromeSafariBrowser.prewarmConnections([TEST_URL_1]);
expect(prewarmingToken, isNotNull); expect(prewarmingToken, isNotNull);
await expectLater( await expectLater(
PlatformChromeSafariBrowser.invalidatePrewarmingToken(prewarmingToken!), ChromeSafariBrowser.invalidatePrewarmingToken(prewarmingToken!),
completes); completes);
}); });
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -11,8 +11,8 @@ void setGetDelete() {
skippableTestWidgets('set, get, delete', (WidgetTester tester) async { skippableTestWidgets('set, get, delete', (WidgetTester tester) async {
CookieManager cookieManager = CookieManager.instance(); CookieManager cookieManager = CookieManager.instance();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(

View File

@ -9,8 +9,8 @@ void convertToInAppWebView() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async { skippableTestWidgets('convert to InAppWebView', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -26,14 +26,14 @@ void convertToInAppWebView() {
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();
expect(url, TEST_CROSS_PLATFORM_URL_1.toString()); expect(url, TEST_CROSS_PLATFORM_URL_1.toString());
final Completer<PlatformInAppWebViewController> widgetControllerCompleter = final Completer<InAppWebViewController> widgetControllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -54,7 +54,7 @@ void convertToInAppWebView() {
), ),
), ),
); );
final PlatformInAppWebViewController widgetController = final InAppWebViewController widgetController =
await widgetControllerCompleter.future; await widgetControllerCompleter.future;
expect(headlessWebView.isRunning(), false); expect(headlessWebView.isRunning(), false);

View File

@ -10,8 +10,8 @@ void customSize() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('set and get custom size', () async { skippableTest('set and get custom size', () async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1), initialUrlRequest: URLRequest(url: TEST_CROSS_PLATFORM_URL_1),

View File

@ -10,8 +10,8 @@ void runAndDispose() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('run and dispose', () async { skippableTest('run and dispose', () async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -27,7 +27,7 @@ void runAndDispose() {
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();

View File

@ -10,8 +10,8 @@ void setGetSettings() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('set/get settings', () async { skippableTest('set/get settings', () async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -26,7 +26,7 @@ void setGetSettings() {
); );
await headlessWebView.run(); await headlessWebView.run();
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var settings = await controller.getSettings(); var settings = await controller.getSettings();

View File

@ -9,8 +9,8 @@ void takeScreenshot() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTest('take screenshot', () async { skippableTest('take screenshot', () async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
@ -27,7 +27,7 @@ void takeScreenshot() {
await headlessWebView.run(); await headlessWebView.run();
expect(headlessWebView.isRunning(), true); expect(headlessWebView.isRunning(), true);
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? url = (await controller.getUrl())?.toString(); final String? url = (await controller.getUrl())?.toString();

View File

@ -12,8 +12,8 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
skippableTestWidgets('load asset file', (WidgetTester tester) async { skippableTestWidgets('load asset file', (WidgetTester tester) async {
expect(localhostServer.isRunning(), true); expect(localhostServer.isRunning(), true);
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
var headlessWebView = new HeadlessInAppWebView( var headlessWebView = new HeadlessInAppWebView(
initialUrlRequest: URLRequest( initialUrlRequest: URLRequest(
@ -40,7 +40,7 @@ void loadAssetFile(InAppLocalhostServer localhostServer) {
), ),
); );
} }
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, 'http://localhost:8080/test_assets/index.html'); expect(currentUrl, 'http://localhost:8080/test_assets/index.html');

View File

@ -41,8 +41,8 @@ void audioPlaybackPolicy() {
}); });
skippableTestWidgets('Auto media playback', (WidgetTester tester) async { skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
Completer<PlatformInAppWebViewController> controllerCompleter = Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
Completer<void> pageStarted = Completer<void>(); Completer<void> pageStarted = Completer<void>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
@ -69,7 +69,7 @@ void audioPlaybackPolicy() {
), ),
), ),
); );
PlatformInAppWebViewController controller = await controllerCompleter.future; InAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
await pageLoaded.future; await pageLoaded.future;
@ -77,7 +77,7 @@ void audioPlaybackPolicy() {
await controller.evaluateJavascript(source: 'isPaused();'); await controller.evaluateJavascript(source: 'isPaused();');
expect(isPaused, false); expect(isPaused, false);
controllerCompleter = Completer<PlatformInAppWebViewController>(); controllerCompleter = Completer<InAppWebViewController>();
pageStarted = Completer<void>(); pageStarted = Completer<void>();
pageLoaded = Completer<void>(); pageLoaded = Completer<void>();

View File

@ -10,8 +10,8 @@ void clearCache() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearCache', (WidgetTester tester) async { skippableTestWidgets('clearCache', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void clearCache() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearCache(), completes); await expectLater(controller.clearCache(), completes);
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -10,8 +10,8 @@ void clearFocus() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearFocus', (WidgetTester tester) async { skippableTestWidgets('clearFocus', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void clearFocus() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearFocus(), completes); await expectLater(controller.clearFocus(), completes);

View File

@ -8,8 +8,8 @@ void clearSslPreferences() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async { skippableTestWidgets('clearSslPreferences', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void clearSslPreferences() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.clearSslPreferences(), completes); await expectLater(controller.clearSslPreferences(), completes);
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -10,8 +10,8 @@ void contentBlocker() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('Content Blocker', (WidgetTester tester) async { skippableTestWidgets('Content Blocker', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(

View File

@ -9,8 +9,8 @@ void createPdf() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('createPdf', (WidgetTester tester) async { skippableTestWidgets('createPdf', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -29,7 +29,7 @@ void createPdf() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var pdfConfiguration = PDFConfiguration( var pdfConfiguration = PDFConfiguration(

View File

@ -10,8 +10,8 @@ void getCertificate() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('getCertificate', (WidgetTester tester) async { skippableTestWidgets('getCertificate', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void getCertificate() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var sslCertificate = await controller.getCertificate(); var sslCertificate = await controller.getCertificate();

View File

@ -12,8 +12,8 @@ void getContentHeight() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getContentHeight', (WidgetTester tester) async { skippableTestWidgets('getContentHeight', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getContentHeight() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();

View File

@ -12,8 +12,8 @@ void getFavicons() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getFavicons', (WidgetTester tester) async { skippableTestWidgets('getFavicons', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getFavicons() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final List<Favicon>? favicons = await controller.getFavicons(); final List<Favicon>? favicons = await controller.getFavicons();

View File

@ -12,8 +12,8 @@ void getHtml() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getHtml', (WidgetTester tester) async { skippableTestWidgets('getHtml', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getHtml() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String? html = await controller.getHtml(); final String? html = await controller.getHtml();

View File

@ -12,8 +12,8 @@ void getMetaTags() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getMetaTags', (WidgetTester tester) async { skippableTestWidgets('getMetaTags', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getMetaTags() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
List<MetaTag> metaTags = await controller.getMetaTags(); List<MetaTag> metaTags = await controller.getMetaTags();

View File

@ -12,8 +12,8 @@ void getMetaThemeColor() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async { skippableTestWidgets('getMetaThemeColor', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getMetaThemeColor() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
expect(await controller.getMetaThemeColor(), isNotNull); expect(await controller.getMetaThemeColor(), isNotNull);

View File

@ -12,8 +12,8 @@ void getOriginalUrl() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async { skippableTestWidgets('getOriginalUrl', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void getOriginalUrl() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
var originUrl = (await controller.getOriginalUrl())?.toString(); var originUrl = (await controller.getOriginalUrl())?.toString();
expect(originUrl, url.toString()); expect(originUrl, url.toString());

View File

@ -10,8 +10,8 @@ void getProgress() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('getProgress', (WidgetTester tester) async { skippableTestWidgets('getProgress', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void getProgress() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final int? progress = await controller.getProgress(); final int? progress = await controller.getProgress();

View File

@ -28,8 +28,8 @@ void getTitle() {
skippableTestWidgets('getTitle', (WidgetTester tester) async { skippableTestWidgets('getTitle', (WidgetTester tester) async {
final Completer<void> pageStarted = Completer<void>(); final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -49,7 +49,7 @@ void getTitle() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -13,8 +13,8 @@ void httpAuthCredentialDatabase() {
skippableTestWidgets('use saved credentials', (WidgetTester tester) async { skippableTestWidgets('use saved credentials', (WidgetTester tester) async {
HttpAuthCredentialDatabase httpAuthCredentialDatabase = HttpAuthCredentialDatabase httpAuthCredentialDatabase =
HttpAuthCredentialDatabase.instance(); HttpAuthCredentialDatabase.instance();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
httpAuthCredentialDatabase.setHttpAuthCredential( httpAuthCredentialDatabase.setHttpAuthCredential(
@ -50,7 +50,7 @@ void httpAuthCredentialDatabase() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -77,8 +77,8 @@ void httpAuthCredentialDatabase() {
}); });
skippableTestWidgets('save credentials', (WidgetTester tester) async { skippableTestWidgets('save credentials', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -107,7 +107,7 @@ void httpAuthCredentialDatabase() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -21,8 +21,8 @@ void initialUrlRequest() {
'launches with allowsBackForwardNavigationGestures true', 'launches with allowsBackForwardNavigationGestures true',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -46,7 +46,7 @@ void initialUrlRequest() {
), ),
); );
await pageLoaded.future; await pageLoaded.future;
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, TEST_URL_1.toString()); expect(currentUrl, TEST_URL_1.toString());
@ -62,8 +62,8 @@ void initialUrlRequest() {
skippableTestWidgets('basic', (WidgetTester tester) async { skippableTestWidgets('basic', (WidgetTester tester) async {
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -82,7 +82,7 @@ void initialUrlRequest() {
); );
await pageLoaded.future; await pageLoaded.future;
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();

View File

@ -13,8 +13,8 @@ void injectCSS() {
skippableGroup('inject CSS', () { skippableGroup('inject CSS', () {
skippableTestWidgets('code', (WidgetTester tester) async { skippableTestWidgets('code', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -33,7 +33,7 @@ void injectCSS() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -52,8 +52,8 @@ void injectCSS() {
}); });
skippableTestWidgets('file from url', (WidgetTester tester) async { skippableTestWidgets('file from url', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -72,7 +72,7 @@ void injectCSS() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -88,8 +88,8 @@ void injectCSS() {
}); });
skippableTestWidgets('file from asset', (WidgetTester tester) async { skippableTestWidgets('file from asset', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -108,7 +108,7 @@ void injectCSS() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -13,8 +13,8 @@ void injectJavascriptFile() {
skippableGroup('inject javascript file', () { skippableGroup('inject javascript file', () {
skippableTestWidgets('from url', (WidgetTester tester) async { skippableTestWidgets('from url', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> jQueryLoaded = Completer<void>(); final Completer<void> jQueryLoaded = Completer<void>();
final Completer<void> jQueryLoadError = Completer<void>(); final Completer<void> jQueryLoadError = Completer<void>();
@ -35,7 +35,7 @@ void injectJavascriptFile() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -75,8 +75,8 @@ void injectJavascriptFile() {
}); });
skippableTestWidgets('from asset', (WidgetTester tester) async { skippableTestWidgets('from asset', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -95,7 +95,7 @@ void injectJavascriptFile() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -11,8 +11,8 @@ void interceptAjaxRequest() {
skippableGroup('intercept ajax request', () { skippableGroup('intercept ajax request', () {
skippableTestWidgets('send string data', (WidgetTester tester) async { skippableTestWidgets('send string data', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -93,8 +93,8 @@ void interceptAjaxRequest() {
}); });
skippableTestWidgets('send json data', (WidgetTester tester) async { skippableTestWidgets('send json data', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -182,8 +182,8 @@ void interceptAjaxRequest() {
skippableTestWidgets('send URLSearchParams data', skippableTestWidgets('send URLSearchParams data',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =
@ -266,8 +266,8 @@ void interceptAjaxRequest() {
}); });
skippableTestWidgets('send FormData', (WidgetTester tester) async { skippableTestWidgets('send FormData', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer shouldInterceptAjaxPostRequestCompleter = final Completer shouldInterceptAjaxPostRequestCompleter =
Completer<void>(); Completer<void>();
final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter = final Completer<Map<String, dynamic>> onAjaxReadyStateChangeCompleter =

View File

@ -11,8 +11,8 @@ void interceptFetchRequest() {
skippableGroup('intercept fetch request', () { skippableGroup('intercept fetch request', () {
skippableTestWidgets('send string data', (WidgetTester tester) async { skippableTestWidgets('send string data', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -86,8 +86,8 @@ void interceptFetchRequest() {
}); });
skippableTestWidgets('send json data', (WidgetTester tester) async { skippableTestWidgets('send json data', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -168,8 +168,8 @@ void interceptFetchRequest() {
skippableTestWidgets('send URLSearchParams data', skippableTestWidgets('send URLSearchParams data',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =
@ -245,8 +245,8 @@ void interceptFetchRequest() {
}); });
skippableTestWidgets('send FormData', (WidgetTester tester) async { skippableTestWidgets('send FormData', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<Map<String, dynamic>> fetchPostCompleter = final Completer<Map<String, dynamic>> fetchPostCompleter =
Completer<Map<String, dynamic>>(); Completer<Map<String, dynamic>>();
final Completer<void> shouldInterceptFetchPostRequestCompleter = final Completer<void> shouldInterceptFetchPostRequestCompleter =

View File

@ -10,8 +10,8 @@ void isLoading() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('isLoading', (WidgetTester tester) async { skippableTestWidgets('isLoading', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageStarted = Completer<void>(); final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
@ -35,7 +35,7 @@ void isLoading() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future; await pageStarted.future;
expect(await controller.isLoading(), true); expect(await controller.isLoading(), true);

View File

@ -12,8 +12,8 @@ void isSecureContext() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('isSecureContext', (WidgetTester tester) async { skippableTestWidgets('isSecureContext', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -33,7 +33,7 @@ void isSecureContext() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
expect(await controller.isSecureContext(), true); expect(await controller.isSecureContext(), true);

View File

@ -19,8 +19,8 @@ void javascriptCodeEvaluation() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async { skippableTestWidgets('evaluateJavascript', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -38,7 +38,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -63,8 +63,8 @@ void javascriptCodeEvaluation() {
skippableTestWidgets('evaluateJavascript with content world', skippableTestWidgets('evaluateJavascript with content world',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -82,7 +82,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -107,8 +107,8 @@ void javascriptCodeEvaluation() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async { skippableTestWidgets('callAsyncJavaScript', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -126,7 +126,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -169,8 +169,8 @@ void javascriptCodeEvaluation() {
skippableTestWidgets('callAsyncJavaScript with content world', skippableTestWidgets('callAsyncJavaScript with content world',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -188,7 +188,7 @@ void javascriptCodeEvaluation() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -10,8 +10,8 @@ void javascriptDialogs() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('javascript dialogs', (WidgetTester tester) async { skippableTestWidgets('javascript dialogs', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<JsAlertRequest> alertCompleter = final Completer<JsAlertRequest> alertCompleter =
Completer<JsAlertRequest>(); Completer<JsAlertRequest>();

View File

@ -10,8 +10,8 @@ void javascriptHandler() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async { skippableTestWidgets('JavaScript Handler', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageStarted = Completer<void>(); final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> handlerFoo = Completer<void>(); final Completer<void> handlerFoo = Completer<void>();

View File

@ -15,10 +15,10 @@ void keepAlive() {
skippableTestWidgets('Keep Alive', (WidgetTester tester) async { skippableTestWidgets('Keep Alive', (WidgetTester tester) async {
final keepAlive = InAppWebViewKeepAlive(); final keepAlive = InAppWebViewKeepAlive();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<PlatformInAppWebViewController> controllerCompleter2 = final Completer<InAppWebViewController> controllerCompleter2 =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> pageLoaded2 = Completer<void>(); final Completer<void> pageLoaded2 = Completer<void>();
@ -46,7 +46,7 @@ void keepAlive() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.loadUrl( await controller.loadUrl(
@ -64,7 +64,7 @@ void keepAlive() {
}, },
)), )),
); );
final PlatformInAppWebViewController controller2 = final InAppWebViewController controller2 =
await controllerCompleter2.future; await controllerCompleter2.future;
final String? currentUrl = (await controller2.getUrl())?.toString(); final String? currentUrl = (await controller2.getUrl())?.toString();

View File

@ -10,8 +10,8 @@ void loadData() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadData', (WidgetTester tester) async { skippableTestWidgets('loadData', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -31,7 +31,7 @@ void loadData() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
final data = """ final data = """

View File

@ -10,8 +10,8 @@ void loadFile() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadFile', (WidgetTester tester) async { skippableTestWidgets('loadFile', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -31,7 +31,7 @@ void loadFile() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
await controller.loadFile( await controller.loadFile(

View File

@ -12,8 +12,8 @@ void loadUrl() {
var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var initialUrl = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('loadUrl', (WidgetTester tester) async { skippableTestWidgets('loadUrl', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> firstUrlLoad = Completer<String>(); final Completer<String> firstUrlLoad = Completer<String>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
@ -38,7 +38,7 @@ void loadUrl() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
expect(await firstUrlLoad.future, initialUrl.toString()); expect(await firstUrlLoad.future, initialUrl.toString());
await controller.loadUrl( await controller.loadUrl(
@ -54,8 +54,8 @@ void loadUrl() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async { skippableTestWidgets('loadSimulatedRequest', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> firstUrlLoad = Completer<String>(); final Completer<String> firstUrlLoad = Completer<String>();
final Completer<String> loadedUrl = Completer<String>(); final Completer<String> loadedUrl = Completer<String>();
@ -80,7 +80,7 @@ void loadUrl() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
expect(await firstUrlLoad.future, initialUrl.toString()); expect(await firstUrlLoad.future, initialUrl.toString());
final htmlCode = "<h1>Hello</h1>"; final htmlCode = "<h1>Hello</h1>";

View File

@ -10,8 +10,8 @@ void onConsoleMessage() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async { skippableTestWidgets('onConsoleMessage', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<ConsoleMessage> onConsoleMessageCompleter = final Completer<ConsoleMessage> onConsoleMessageCompleter =
Completer<ConsoleMessage>(); Completer<ConsoleMessage>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void onDownloadStartRequest() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async { skippableTestWidgets('onDownloadStartRequest', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> onDownloadStartCompleter = Completer<String>(); final Completer<String> onDownloadStartCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(

View File

@ -9,8 +9,8 @@ void onJsBeforeUnload() {
final shouldSkip = true; final shouldSkip = true;
// on Android, for some reason, it works on an example app but not in this test // on Android, for some reason, it works on an example app but not in this test
skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async { skippableTestWidgets('onJsBeforeUnload', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> onJsBeforeUnloadCompleter = Completer<String>(); final Completer<String> onJsBeforeUnloadCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -11,8 +11,8 @@ void onLoadResourceWithCustomScheme() {
skippableTestWidgets('onLoadResourceWithCustomScheme', skippableTestWidgets('onLoadResourceWithCustomScheme',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> imageLoaded = Completer<void>(); final Completer<void> imageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void onNavigationResponse() {
skippableGroup('onNavigationResponse', () { skippableGroup('onNavigationResponse', () {
skippableTestWidgets('allow navigation', (WidgetTester tester) async { skippableTestWidgets('allow navigation', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<String> onNavigationResponseCompleter = final Completer<String> onNavigationResponseCompleter =
Completer<String>(); Completer<String>();
@ -43,8 +43,8 @@ void onNavigationResponse() {
}); });
skippableTestWidgets('cancel navigation', (WidgetTester tester) async { skippableTestWidgets('cancel navigation', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<String> onNavigationResponseCompleter = final Completer<String> onNavigationResponseCompleter =
Completer<String>(); Completer<String>();

View File

@ -10,8 +10,8 @@ void onPageCommitVisible() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async { skippableTestWidgets('onPageCommitVisible', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> onPageCommitVisibleCompleter = Completer<String>(); final Completer<String> onPageCommitVisibleCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -12,8 +12,8 @@ void onPermissionRequest() {
final expectedValue = [PermissionResourceType.CAMERA]; final expectedValue = [PermissionResourceType.CAMERA];
skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async { skippableTestWidgets('onPermissionRequest', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter = final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
Completer<List<PermissionResourceType>>(); Completer<List<PermissionResourceType>>();
@ -40,7 +40,7 @@ void onPermissionRequest() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "document.querySelector('#camera').click();"); source: "document.querySelector('#camera').click();");
@ -61,8 +61,8 @@ void onPermissionRequest() {
skippableTestWidgets('onPermissionRequestCanceled', skippableTestWidgets('onPermissionRequestCanceled',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<List<PermissionResourceType>> onPermissionRequestCompleter = final Completer<List<PermissionResourceType>> onPermissionRequestCompleter =
Completer<List<PermissionResourceType>>(); Completer<List<PermissionResourceType>>();
@ -99,7 +99,7 @@ void onPermissionRequest() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "document.querySelector('#camera').click();"); source: "document.querySelector('#camera').click();");

View File

@ -8,8 +8,8 @@ void onReceivedIcon() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async { skippableTestWidgets('onReceivedIcon', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<Uint8List> onReceivedIconCompleter = Completer<Uint8List>(); final Completer<Uint8List> onReceivedIconCompleter = Completer<Uint8List>();

View File

@ -8,8 +8,8 @@ void onReceivedTouchIconUrl() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async { skippableTestWidgets('onReceivedTouchIconUrl', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> onReceivedTouchIconUrlCompleter = final Completer<String> onReceivedTouchIconUrlCompleter =
Completer<String>(); Completer<String>();

View File

@ -12,8 +12,8 @@ void onScrollChanged() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('onScrollChanged', (WidgetTester tester) async { skippableTestWidgets('onScrollChanged', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onScrollChangedCompleter = Completer<void>(); final Completer<void> onScrollChangedCompleter = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -37,7 +37,7 @@ void onScrollChanged() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();

View File

@ -12,8 +12,8 @@ void onTitleChanged() {
var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('onTitleChanged', (WidgetTester tester) async { skippableTestWidgets('onTitleChanged', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onTitleChangedCompleter = Completer<void>(); final Completer<void> onTitleChangedCompleter = Completer<void>();
@ -40,7 +40,7 @@ void onTitleChanged() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await controller.evaluateJavascript( await controller.evaluateJavascript(

View File

@ -12,8 +12,8 @@ void onUpdateVisitedHistory() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async { skippableTestWidgets('onUpdateVisitedHistory', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> firstPushCompleter = Completer<String>(); final Completer<String> firstPushCompleter = Completer<String>();
final Completer<String> secondPushCompleter = Completer<String>(); final Completer<String> secondPushCompleter = Completer<String>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
@ -42,7 +42,7 @@ void onUpdateVisitedHistory() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript(source: """ await controller.evaluateJavascript(source: """

View File

@ -8,8 +8,8 @@ void pageDownUp() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async { skippableTestWidgets('pageDown/pageUp', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void pageDownUp() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -8,8 +8,8 @@ void pauseResume() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pause/resume', (WidgetTester tester) async { skippableTestWidgets('pause/resume', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -28,7 +28,7 @@ void pauseResume() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.pause(), completes); await expectLater(controller.pause(), completes);
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -10,8 +10,8 @@ void pauseResumeTimers() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('pause/resume timers', (WidgetTester tester) async { skippableTestWidgets('pause/resume timers', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void pauseResumeTimers() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.evaluateJavascript(source: """ await controller.evaluateJavascript(source: """

View File

@ -11,8 +11,8 @@ void postRequests() {
skippableGroup('POST requests', () { skippableGroup('POST requests', () {
skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async { skippableTestWidgets('initialUrlRequest', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -36,7 +36,7 @@ void postRequests() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await postPageLoaded.future; await postPageLoaded.future;
@ -50,8 +50,8 @@ void postRequests() {
}); });
skippableTestWidgets('loadUrl', (WidgetTester tester) async { skippableTestWidgets('loadUrl', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -72,7 +72,7 @@ void postRequests() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
var postData = Uint8List.fromList(utf8.encode("name=FooBar")); var postData = Uint8List.fromList(utf8.encode("name=FooBar"));
@ -96,8 +96,8 @@ void postRequests() {
}); });
skippableTestWidgets('postUrl', (WidgetTester tester) async { skippableTestWidgets('postUrl', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> postPageLoaded = Completer<void>(); final Completer<void> postPageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -118,7 +118,7 @@ void postRequests() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
var postData = Uint8List.fromList(utf8.encode("name=FooBar")); var postData = Uint8List.fromList(utf8.encode("name=FooBar"));

View File

@ -12,8 +12,8 @@ void printCurrentPage() {
var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; var url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('printCurrentPage', (WidgetTester tester) async { skippableTestWidgets('printCurrentPage', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void printCurrentPage() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await tester.pump(); await tester.pump();
await expectLater(controller.printCurrentPage(), completes); await expectLater(controller.printCurrentPage(), completes);

View File

@ -49,8 +49,8 @@ void programmaticScroll() {
: TEST_WEB_PLATFORM_URL_1; : TEST_WEB_PLATFORM_URL_1;
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -67,7 +67,7 @@ void programmaticScroll() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -127,8 +127,8 @@ void programmaticScroll() {
base64Encode(const Utf8Encoder().convert(scrollTestPage)); base64Encode(const Utf8Encoder().convert(scrollTestPage));
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -148,7 +148,7 @@ void programmaticScroll() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await controller.scrollTo(x: 0, y: 0); await controller.scrollTo(x: 0, y: 0);

View File

@ -17,8 +17,8 @@ void programmaticZoomScale() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async { skippableTestWidgets('zoomIn/zoomOut', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -37,7 +37,7 @@ void programmaticZoomScale() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
expect(await controller.zoomIn(), true); expect(await controller.zoomIn(), true);
@ -46,8 +46,8 @@ void programmaticZoomScale() {
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async { skippableTestWidgets('onZoomScaleChanged', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> onZoomScaleChangedCompleter = Completer<void>(); final Completer<void> onZoomScaleChangedCompleter = Completer<void>();
@ -76,7 +76,7 @@ void programmaticZoomScale() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
listenForScaleChange = true; listenForScaleChange = true;
@ -87,8 +87,8 @@ void programmaticZoomScale() {
}); });
skippableTestWidgets('zoomBy', (WidgetTester tester) async { skippableTestWidgets('zoomBy', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -107,7 +107,7 @@ void programmaticZoomScale() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -116,8 +116,8 @@ void programmaticZoomScale() {
}); });
skippableTestWidgets('getZoomScale', (WidgetTester tester) async { skippableTestWidgets('getZoomScale', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -136,7 +136,7 @@ void programmaticZoomScale() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -11,8 +11,8 @@ void pullToRefresh() {
skippableTestWidgets('launches with pull-to-refresh feature', skippableTestWidgets('launches with pull-to-refresh feature',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final pullToRefreshController = PullToRefreshController( final pullToRefreshController = PullToRefreshController(
settings: PullToRefreshSettings( settings: PullToRefreshSettings(
color: Colors.blue, color: Colors.blue,
@ -38,7 +38,7 @@ void pullToRefresh() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
final String? currentUrl = (await controller.getUrl())?.toString(); final String? currentUrl = (await controller.getUrl())?.toString();
expect(currentUrl, TEST_URL_1.toString()); expect(currentUrl, TEST_URL_1.toString());
}, skip: shouldSkip); }, skip: shouldSkip);

View File

@ -20,8 +20,8 @@ void reload() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('from origin', (WidgetTester tester) async { skippableTestWidgets('from origin', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -42,15 +42,15 @@ void reload() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.reloadFromOrigin(), completes); await expectLater(controller.reloadFromOrigin(), completes);
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('basic', (WidgetTester tester) async { skippableTestWidgets('basic', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -69,7 +69,7 @@ void reload() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
String? reloadUrl = await pageLoads.stream.first; String? reloadUrl = await pageLoads.stream.first;
expect(reloadUrl, url.toString()); expect(reloadUrl, url.toString());

View File

@ -10,8 +10,8 @@ void requestFocusNodeHref() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async { skippableTestWidgets('requestFocusNodeHref', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void requestFocusNodeHref() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.requestFocusNodeHref(), completes); await expectLater(controller.requestFocusNodeHref(), completes);

View File

@ -10,8 +10,8 @@ void requestImageRef() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('requestImageRef', (WidgetTester tester) async { skippableTestWidgets('requestImageRef', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void requestImageRef() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await expectLater(controller.requestImageRef(), completes); await expectLater(controller.requestImageRef(), completes);

View File

@ -31,8 +31,8 @@ void resizeWebView() {
final Completer<void> resizeCompleter = Completer<void>(); final Completer<void> resizeCompleter = Completer<void>();
final Completer<void> pageStarted = Completer<void>(); final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final GlobalKey key = GlobalKey(); final GlobalKey key = GlobalKey();
final InAppWebView webView = InAppWebView( final InAppWebView webView = InAppWebView(

View File

@ -10,7 +10,7 @@ void setCustomUserAgent() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('set custom userAgent', (WidgetTester tester) async { skippableTestWidgets('set custom userAgent', (WidgetTester tester) async {
final Completer controllerCompleter1 = Completer<PlatformInAppWebViewController>(); final Completer controllerCompleter1 = Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,

View File

@ -12,8 +12,8 @@ void setGetSettings() {
final url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1; final url = !kIsWeb ? TEST_CROSS_PLATFORM_URL_1 : TEST_WEB_PLATFORM_URL_1;
skippableTestWidgets('set/get settings', (WidgetTester tester) async { skippableTestWidgets('set/get settings', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -32,7 +32,7 @@ void setGetSettings() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
InAppWebViewSettings? settings = await controller.getSettings(); InAppWebViewSettings? settings = await controller.getSettings();

View File

@ -15,8 +15,8 @@ void shouldInterceptRequest() {
]; ];
List<String> resourceLoaded = []; List<String> resourceLoaded = [];
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer<void> loadedResourceCompleter = Completer<void>(); final Completer<void> loadedResourceCompleter = Completer<void>();

View File

@ -16,8 +16,8 @@ void shouldOverrideUrlLoading() {
base64Encode(const Utf8Encoder().convert(page)); base64Encode(const Utf8Encoder().convert(page));
skippableTestWidgets('can allow requests', (WidgetTester tester) async { skippableTestWidgets('can allow requests', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -43,7 +43,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');
@ -65,8 +65,8 @@ void shouldOverrideUrlLoading() {
testWidgets( testWidgets(
'allow requests on iOS only if navigationType == NavigationType.LINK_ACTIVATED', 'allow requests on iOS only if navigationType == NavigationType.LINK_ACTIVATED',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -94,7 +94,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');
@ -120,8 +120,8 @@ void shouldOverrideUrlLoading() {
}, skip: shouldSkipTest2); }, skip: shouldSkipTest2);
skippableTestWidgets('can block requests', (WidgetTester tester) async { skippableTestWidgets('can block requests', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -147,7 +147,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_4"'); source: 'location.href = "$TEST_URL_4"');
@ -169,8 +169,8 @@ void shouldOverrideUrlLoading() {
skippableTestWidgets('supports asynchronous decisions', skippableTestWidgets('supports asynchronous decisions',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -197,7 +197,7 @@ void shouldOverrideUrlLoading() {
); );
await pageLoads.stream.first; // Wait for initial page load. await pageLoads.stream.first; // Wait for initial page load.
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'location.href = "$TEST_URL_2"'); source: 'location.href = "$TEST_URL_2"');

View File

@ -10,8 +10,8 @@ void sslRequest() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('SSL request', (WidgetTester tester) async { skippableTestWidgets('SSL request', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -40,7 +40,7 @@ void sslRequest() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
final String h1Content = await controller.evaluateJavascript( final String h1Content = await controller.evaluateJavascript(

View File

@ -10,8 +10,8 @@ void stopLoading() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('stopLoading', (WidgetTester tester) async { skippableTestWidgets('stopLoading', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -34,7 +34,7 @@ void stopLoading() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
if (defaultTargetPlatform == TargetPlatform.android) { if (defaultTargetPlatform == TargetPlatform.android) {
await pageLoaded.future; await pageLoaded.future;

View File

@ -10,8 +10,8 @@ void tRexRunnerGame() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('T-Rex Runner game', (WidgetTester tester) async { skippableTestWidgets('T-Rex Runner game', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(

View File

@ -10,8 +10,8 @@ void takeScreenshot() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('takeScreenshot', (WidgetTester tester) async { skippableTestWidgets('takeScreenshot', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -30,7 +30,7 @@ void takeScreenshot() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -11,8 +11,8 @@ void userScripts() {
skippableGroup('user scripts', () { skippableGroup('user scripts', () {
skippableTestWidgets('initialUserScripts', (WidgetTester tester) async { skippableTestWidgets('initialUserScripts', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -47,7 +47,7 @@ void userScripts() {
), ),
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -71,8 +71,8 @@ void userScripts() {
skippableTestWidgets('add/remove user scripts', skippableTestWidgets('add/remove user scripts',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -92,7 +92,7 @@ void userScripts() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;

View File

@ -50,8 +50,8 @@ void videoPlaybackPolicy() {
}); });
skippableTestWidgets('Auto media playback', (WidgetTester tester) async { skippableTestWidgets('Auto media playback', (WidgetTester tester) async {
Completer<PlatformInAppWebViewController> controllerCompleter = Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -74,14 +74,14 @@ void videoPlaybackPolicy() {
), ),
), ),
); );
PlatformInAppWebViewController controller = await controllerCompleter.future; InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
bool isPaused = bool isPaused =
await controller.evaluateJavascript(source: 'isPaused();'); await controller.evaluateJavascript(source: 'isPaused();');
expect(isPaused, false); expect(isPaused, false);
controllerCompleter = Completer<PlatformInAppWebViewController>(); controllerCompleter = Completer<InAppWebViewController>();
pageLoaded = Completer<void>(); pageLoaded = Completer<void>();
// We change the key to re-create a new webview as we change the mediaPlaybackRequiresUserGesture // We change the key to re-create a new webview as we change the mediaPlaybackRequiresUserGesture
@ -123,8 +123,8 @@ void videoPlaybackPolicy() {
skippableTestWidgets( skippableTestWidgets(
'Video plays inline when allowsInlineMediaPlayback is true', 'Video plays inline when allowsInlineMediaPlayback is true',
(WidgetTester tester) async { (WidgetTester tester) async {
Completer<PlatformInAppWebViewController> controllerCompleter = Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onEnterFullscreenCompleter = Completer<void>(); Completer<void> onEnterFullscreenCompleter = Completer<void>();
@ -167,8 +167,8 @@ void videoPlaybackPolicy() {
testWidgets( testWidgets(
'Video plays fullscreen when allowsInlineMediaPlayback is false', 'Video plays fullscreen when allowsInlineMediaPlayback is false',
(WidgetTester tester) async { (WidgetTester tester) async {
Completer<PlatformInAppWebViewController> controllerCompleter = Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onEnterFullscreenCompleter = Completer<void>(); Completer<void> onEnterFullscreenCompleter = Completer<void>();
@ -212,8 +212,8 @@ void videoPlaybackPolicy() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
// on Android, entering fullscreen requires user interaction // on Android, entering fullscreen requires user interaction
skippableTestWidgets('exit fullscreen event', (WidgetTester tester) async { skippableTestWidgets('exit fullscreen event', (WidgetTester tester) async {
Completer<PlatformInAppWebViewController> controllerCompleter = Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
Completer<void> pageLoaded = Completer<void>(); Completer<void> pageLoaded = Completer<void>();
Completer<void> onExitFullscreenCompleter = Completer<void>(); Completer<void> onExitFullscreenCompleter = Completer<void>();
@ -242,7 +242,7 @@ void videoPlaybackPolicy() {
), ),
); );
PlatformInAppWebViewController controller = await controllerCompleter.future; InAppWebViewController controller = await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
await Future.delayed(Duration(seconds: 2)); await Future.delayed(Duration(seconds: 2));

View File

@ -18,8 +18,8 @@ void webArchive() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('create data', (WidgetTester tester) async { skippableTestWidgets('create data', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -38,7 +38,7 @@ void webArchive() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;
@ -46,8 +46,8 @@ void webArchive() {
}, skip: shouldSkipTest1); }, skip: shouldSkipTest1);
skippableTestWidgets('save', (WidgetTester tester) async { skippableTestWidgets('save', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -66,7 +66,7 @@ void webArchive() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoaded.future; await pageLoaded.future;

View File

@ -20,8 +20,8 @@ void webHistory() {
skippableTestWidgets('get history list and go back/forward', skippableTestWidgets('get history list and go back/forward',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -39,7 +39,7 @@ void webHistory() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));
@ -119,8 +119,8 @@ void webHistory() {
skippableTestWidgets('go back/forward on web platform', skippableTestWidgets('go back/forward on web platform',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -140,7 +140,7 @@ void webHistory() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await tester.pump(); await tester.pump();
@ -178,8 +178,8 @@ void webHistory() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('clearHistory', (WidgetTester tester) async { skippableTestWidgets('clearHistory', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
@ -199,7 +199,7 @@ void webHistory() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoads.stream.first; await pageLoads.stream.first;
await controller.loadUrl(urlRequest: URLRequest(url: TEST_URL_1)); await controller.loadUrl(urlRequest: URLRequest(url: TEST_URL_1));

View File

@ -12,8 +12,8 @@ void webMessage() {
skippableGroup('WebMessage', () { skippableGroup('WebMessage', () {
skippableTestWidgets('WebMessageChannel post String', skippableTestWidgets('WebMessageChannel post String',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -81,8 +81,8 @@ void webMessage() {
skippableTestWidgets('WebMessageChannel post ArrayBuffer', skippableTestWidgets('WebMessageChannel post ArrayBuffer',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -167,8 +167,8 @@ void webMessage() {
skippableTestWidgets('WebMessageListener post String', skippableTestWidgets('WebMessageListener post String',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -177,7 +177,7 @@ void webMessage() {
child: InAppWebView( child: InAppWebView(
key: GlobalKey(), key: GlobalKey(),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener( await controller.addWebMessageListener(WebMessageListener(
jsObjectName: "myTestObj", jsObjectName: "myTestObj",
allowedOriginRules: Set.from(["https://*.example.com"]), allowedOriginRules: Set.from(["https://*.example.com"]),
onPostMessage: onPostMessage:
@ -222,8 +222,8 @@ void webMessage() {
skippableTestWidgets('WebMessageListener post ArrayBuffer', skippableTestWidgets('WebMessageListener post ArrayBuffer',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
final Completer webMessageCompleter = Completer<String>(); final Completer webMessageCompleter = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -232,7 +232,7 @@ void webMessage() {
child: InAppWebView( child: InAppWebView(
key: GlobalKey(), key: GlobalKey(),
onWebViewCreated: (controller) async { onWebViewCreated: (controller) async {
await InAppWebViewController.fromPlatform(platform: controller).addWebMessageListener(WebMessageListener( await controller.addWebMessageListener(WebMessageListener(
jsObjectName: "myTestObj", jsObjectName: "myTestObj",
allowedOriginRules: Set.from(["https://*.example.com"]), allowedOriginRules: Set.from(["https://*.example.com"]),
onPostMessage: onPostMessage:

View File

@ -8,8 +8,8 @@ void webViewAssetLoader() {
].contains(defaultTargetPlatform); ].contains(defaultTargetPlatform);
skippableTestWidgets('WebViewAssetLoader', (WidgetTester tester) async { skippableTestWidgets('WebViewAssetLoader', (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
@ -25,7 +25,7 @@ void webViewAssetLoader() {
allowContentAccess: false, allowContentAccess: false,
webViewAssetLoader: WebViewAssetLoader( webViewAssetLoader: WebViewAssetLoader(
domain: TEST_WEBVIEW_ASSET_LOADER_DOMAIN, domain: TEST_WEBVIEW_ASSET_LOADER_DOMAIN,
pathHandlers: [AssetsPathHandler(path: '/assets/')]).platform), pathHandlers: [AssetsPathHandler(path: '/assets/')])),
onWebViewCreated: (controller) { onWebViewCreated: (controller) {
controllerCompleter.complete(controller); controllerCompleter.complete(controller);
}, },
@ -36,7 +36,7 @@ void webViewAssetLoader() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
final url = await pageLoaded.future; final url = await pageLoaded.future;
expect(url, TEST_WEBVIEW_ASSET_LOADER_URL.toString()); expect(url, TEST_WEBVIEW_ASSET_LOADER_URL.toString());

View File

@ -20,8 +20,8 @@ void webViewWindows() {
skippableTestWidgets('onCreateWindow return false', skippableTestWidgets('onCreateWindow return false',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoaded = Completer<void>(); final Completer<void> pageLoaded = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -63,8 +63,8 @@ void webViewWindows() {
skippableTestWidgets('onCreateWindow return true', skippableTestWidgets('onCreateWindow return true',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<int> onCreateWindowCompleter = Completer<int>(); final Completer<int> onCreateWindowCompleter = Completer<int>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -91,7 +91,7 @@ void webViewWindows() {
var windowId = await onCreateWindowCompleter.future; var windowId = await onCreateWindowCompleter.future;
final Completer windowControllerCompleter = final Completer windowControllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> windowPageLoaded = Completer<String>(); final Completer<String> windowPageLoaded = Completer<String>();
final Completer<void> onCloseWindowCompleter = Completer<void>(); final Completer<void> onCloseWindowCompleter = Completer<void>();
@ -137,8 +137,8 @@ void webViewWindows() {
skippableTestWidgets( skippableTestWidgets(
'window.open() with target _blank opens in same window', 'window.open() with target _blank opens in same window',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -160,7 +160,7 @@ void webViewWindows() {
), ),
); );
await pageLoads.stream.first; await pageLoads.stream.first;
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
@ -181,8 +181,8 @@ void webViewWindows() {
// on Android, for some reason, it works on an example app but not in this test // on Android, for some reason, it works on an example app but not in this test
skippableTestWidgets('can open new window and go back', skippableTestWidgets('can open new window and go back',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final StreamController<String> pageLoads = final StreamController<String> pageLoads =
StreamController<String>.broadcast(); StreamController<String>.broadcast();
await tester.pumpWidget( await tester.pumpWidget(
@ -205,7 +205,7 @@ void webViewWindows() {
), ),
); );
await pageLoads.stream.first; await pageLoads.stream.first;
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await tester.pump(); await tester.pump();
@ -264,8 +264,8 @@ void webViewWindows() {
'''; ''';
final String openWindowTestBase64 = final String openWindowTestBase64 =
base64Encode(const Utf8Encoder().convert(openWindowTest)); base64Encode(const Utf8Encoder().convert(openWindowTest));
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<void> pageLoadCompleter = Completer<void>(); final Completer<void> pageLoadCompleter = Completer<void>();
await tester.pumpWidget( await tester.pumpWidget(
@ -290,7 +290,7 @@ void webViewWindows() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await pageLoadCompleter.future; await pageLoadCompleter.future;
@ -309,8 +309,8 @@ void webViewWindows() {
// on Web, opening a new window during tests makes crash // on Web, opening a new window during tests makes crash
skippableTestWidgets('onCreateWindow called on Web', skippableTestWidgets('onCreateWindow called on Web',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> onCreateWindowCalled = Completer<String>(); final Completer<String> onCreateWindowCalled = Completer<String>();
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
@ -334,7 +334,7 @@ void webViewWindows() {
), ),
); );
final PlatformInAppWebViewController controller = final InAppWebViewController controller =
await controllerCompleter.future; await controllerCompleter.future;
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: "window.open('$TEST_CROSS_PLATFORM_URL_1');"); source: "window.open('$TEST_CROSS_PLATFORM_URL_1');");

View File

@ -9,8 +9,8 @@ void clearAndSetProxyOverride() {
skippableTestWidgets('clear and set proxy override', skippableTestWidgets('clear and set proxy override',
(WidgetTester tester) async { (WidgetTester tester) async {
final Completer<PlatformInAppWebViewController> controllerCompleter = final Completer<InAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>(); Completer<InAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>(); final Completer<String> pageLoaded = Completer<String>();
var proxyAvailable = var proxyAvailable =
@ -42,7 +42,7 @@ void clearAndSetProxyOverride() {
), ),
); );
final PlatformInAppWebViewController controller = await controllerCompleter.future; final InAppWebViewController controller = await controllerCompleter.future;
final String url = await pageLoaded.future; final String url = await pageLoaded.future;
expect(url, TEST_URL_HTTP_EXAMPLE.toString()); expect(url, TEST_URL_HTTP_EXAMPLE.toString());

View File

@ -111,7 +111,7 @@ class MyInAppBrowser extends InAppBrowser {
} }
} }
class MyChromeSafariBrowser extends PlatformChromeSafariBrowser { class MyChromeSafariBrowser extends ChromeSafariBrowser {
final Completer<void> serviceConnected = Completer<void>(); final Completer<void> serviceConnected = Completer<void>();
final Completer<void> opened = Completer<void>(); final Completer<void> opened = Completer<void>();
final Completer<bool?> firstPageLoaded = Completer<bool?>(); final Completer<bool?> firstPageLoaded = Completer<bool?>();

View File

@ -20,16 +20,16 @@ void main() {
PlatformInAppWebViewController.debugLoggingSettings.usePrint = true; PlatformInAppWebViewController.debugLoggingSettings.usePrint = true;
PlatformInAppWebViewController.debugLoggingSettings.maxLogMessageLength = 7000; PlatformInAppWebViewController.debugLoggingSettings.maxLogMessageLength = 7000;
InAppBrowser.debugLoggingSettings.usePrint = true; PlatformInAppBrowser.debugLoggingSettings.usePrint = true;
InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000; PlatformInAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true; PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true;
PlatformChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength = 7000; PlatformChromeSafariBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
WebAuthenticationSession.debugLoggingSettings.usePrint = true; PlatformWebAuthenticationSession.debugLoggingSettings.usePrint = true;
WebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = 7000; PlatformWebAuthenticationSession.debugLoggingSettings.maxLogMessageLength = 7000;
PullToRefreshController.debugLoggingSettings.usePrint = true; PlatformPullToRefreshController.debugLoggingSettings.usePrint = true;
PullToRefreshController.debugLoggingSettings.maxLogMessageLength = 7000; PlatformPullToRefreshController.debugLoggingSettings.maxLogMessageLength = 7000;
FindInteractionController.debugLoggingSettings.usePrint = true; PlatformFindInteractionController.debugLoggingSettings.usePrint = true;
FindInteractionController.debugLoggingSettings.maxLogMessageLength = 7000; PlatformFindInteractionController.debugLoggingSettings.maxLogMessageLength = 7000;
process_global_config_tests.main(); process_global_config_tests.main();
in_app_webview_tests.main(); in_app_webview_tests.main();

View File

@ -4,7 +4,7 @@ import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'main.dart'; import 'main.dart';
class MyChromeSafariBrowser extends PlatformChromeSafariBrowser { class MyChromeSafariBrowser extends ChromeSafariBrowser {
@override @override
void onOpened() { void onOpened() {
print("ChromeSafari browser opened"); print("ChromeSafari browser opened");
@ -22,7 +22,7 @@ class MyChromeSafariBrowser extends PlatformChromeSafariBrowser {
} }
class ChromeSafariBrowserExampleScreen extends StatefulWidget { class ChromeSafariBrowserExampleScreen extends StatefulWidget {
final PlatformChromeSafariBrowser browser = MyChromeSafariBrowser(); final ChromeSafariBrowser browser = MyChromeSafariBrowser();
@override @override
_ChromeSafariBrowserExampleScreenState createState() => _ChromeSafariBrowserExampleScreenState createState() =>

View File

@ -15,7 +15,7 @@ class InAppWebViewExampleScreen extends StatefulWidget {
class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> { class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {
final GlobalKey webViewKey = GlobalKey(); final GlobalKey webViewKey = GlobalKey();
PlatformInAppWebViewController? webViewController; InAppWebViewController? webViewController;
InAppWebViewSettings settings = InAppWebViewSettings( InAppWebViewSettings settings = InAppWebViewSettings(
isInspectable: kDebugMode, isInspectable: kDebugMode,
mediaPlaybackRequiresUserGesture: false, mediaPlaybackRequiresUserGesture: false,

View File

@ -0,0 +1,600 @@
import 'dart:async';
import 'dart:collection';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
/// Object specifying creation parameters for creating a [AndroidChromeSafariBrowser].
///
/// When adding additional fields make sure they can be null or have a default
/// value to avoid breaking changes. See [PlatformChromeSafariBrowserCreationParams] for
/// more information.
@immutable
class AndroidChromeSafariBrowserCreationParams
extends PlatformChromeSafariBrowserCreationParams {
/// Creates a new [AndroidChromeSafariBrowserCreationParams] instance.
const AndroidChromeSafariBrowserCreationParams();
/// Creates a [AndroidChromeSafariBrowserCreationParams] instance based on [PlatformChromeSafariBrowserCreationParams].
factory AndroidChromeSafariBrowserCreationParams.fromPlatformChromeSafariBrowserCreationParams(
// Recommended placeholder to prevent being broken by platform interface.
// ignore: avoid_unused_constructor_parameters
PlatformChromeSafariBrowserCreationParams params) {
return AndroidChromeSafariBrowserCreationParams();
}
}
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
///
///**NOTE**: If you want to use the `ChromeSafariBrowser` class on Android 11+ you need to specify your app querying for
///`android.support.customtabs.action.CustomTabsService` in your `AndroidManifest.xml`
///(you can read more about it here: https://developers.google.com/web/android/custom-tabs/best-practices#applications_targeting_android_11_api_level_30_or_above).
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
class AndroidChromeSafariBrowser extends PlatformChromeSafariBrowser with ChannelController {
///Debug settings.
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
///View ID used internally.
final String id = IdGenerator.generate();
/// Constructs a [AndroidChromeSafariBrowser].
AndroidChromeSafariBrowser(PlatformChromeSafariBrowserCreationParams params)
: super.implementation(
params is AndroidChromeSafariBrowserCreationParams
? params
: AndroidChromeSafariBrowserCreationParams
.fromPlatformChromeSafariBrowserCreationParams(params),
);
static final AndroidChromeSafariBrowser _staticValue =
AndroidChromeSafariBrowser(AndroidChromeSafariBrowserCreationParams());
factory AndroidChromeSafariBrowser.static() {
return _staticValue;
}
ChromeSafariBrowserActionButton? _actionButton;
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap();
ChromeSafariBrowserSecondaryToolbar? _secondaryToolbar;
bool _isOpened = false;
static const MethodChannel _staticChannel =
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
_init() {
channel =
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id');
handler = _handleMethod;
initMethodCallHandler();
}
_debugLog(String method, dynamic args) {
debugLog(
className: this.runtimeType.toString(),
id: id,
debugLoggingSettings: AndroidChromeSafariBrowser.debugLoggingSettings,
method: method,
args: args);
}
Future<dynamic> _handleMethod(MethodCall call) async {
_debugLog(call.method, call.arguments);
switch (call.method) {
case "onServiceConnected":
eventHandler?.onServiceConnected();
break;
case "onOpened":
eventHandler?.onOpened();
break;
case "onCompletedInitialLoad":
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
eventHandler?.onCompletedInitialLoad(didLoadSuccessfully);
break;
case "onInitialLoadDidRedirect":
final String? url = call.arguments["url"];
final WebUri? uri = url != null ? WebUri(url) : null;
eventHandler?.onInitialLoadDidRedirect(uri);
break;
case "onNavigationEvent":
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
call.arguments["navigationEvent"]);
eventHandler?.onNavigationEvent(navigationEvent);
break;
case "onRelationshipValidationResult":
final relation =
CustomTabsRelationType.fromNativeValue(call.arguments["relation"]);
final requestedOrigin = call.arguments["requestedOrigin"] != null
? WebUri(call.arguments["requestedOrigin"])
: null;
final bool result = call.arguments["result"];
eventHandler?.onRelationshipValidationResult(relation, requestedOrigin, result);
break;
case "onWillOpenInBrowser":
eventHandler?.onWillOpenInBrowser();
break;
case "onClosed":
_isOpened = false;
dispose();
eventHandler?.onClosed();
break;
case "onItemActionPerform":
String url = call.arguments["url"];
String title = call.arguments["title"];
int id = call.arguments["id"].toInt();
if (this._actionButton?.id == id) {
if (this._actionButton?.action != null) {
this._actionButton?.action!(url, title);
}
if (this._actionButton?.onClick != null) {
this._actionButton?.onClick!(WebUri(url), title);
}
} else if (this._menuItems[id] != null) {
if (this._menuItems[id]?.action != null) {
this._menuItems[id]?.action!(url, title);
}
if (this._menuItems[id]?.onClick != null) {
this._menuItems[id]?.onClick!(WebUri(url), title);
}
}
break;
case "onSecondaryItemActionPerform":
final clickableIDs = this._secondaryToolbar?.clickableIDs;
if (clickableIDs != null) {
WebUri? url = call.arguments["url"] != null
? WebUri(call.arguments["url"])
: null;
String name = call.arguments["name"];
for (final clickable in clickableIDs) {
var clickableFullname = clickable.id.name;
if (clickable.id.defType != null &&
!clickableFullname.contains("/")) {
clickableFullname = "${clickable.id.defType}/$clickableFullname";
}
if (clickable.id.defPackage != null &&
!clickableFullname.contains(":")) {
clickableFullname =
"${clickable.id.defPackage}:$clickableFullname";
}
if (clickableFullname == name) {
if (clickable.onClick != null) {
clickable.onClick!(url);
}
break;
}
}
}
break;
case "onMessageChannelReady":
eventHandler?.onMessageChannelReady();
break;
case "onPostMessage":
final String message = call.arguments["message"];
eventHandler?.onPostMessage(message);
break;
case "onVerticalScrollEvent":
final bool isDirectionUp = call.arguments["isDirectionUp"];
eventHandler?.onVerticalScrollEvent(isDirectionUp);
break;
case "onGreatestScrollPercentageIncreased":
final int scrollPercentage = call.arguments["scrollPercentage"];
eventHandler?.onGreatestScrollPercentageIncreased(scrollPercentage);
break;
case "onSessionEnded":
final bool didUserInteract = call.arguments["didUserInteract"];
eventHandler?.onSessionEnded(didUserInteract);
break;
default:
throw UnimplementedError("Unimplemented ${call.method} method");
}
}
///Opens the [AndroidChromeSafariBrowser] instance with an [url].
///
///[url] - The [url] to load. On iOS, the [url] is required and must use the `http` or `https` scheme.
///
///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers.
///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a
///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started).
///
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order. Supported only on Android.
///
///[referrer] - referrer header. Supported only on Android.
///
///[options] - Deprecated. Use `settings` instead.
///
///[settings] - Settings for the [AndroidChromeSafariBrowser].
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
Future<void> open(
{WebUri? url,
Map<String, String>? headers,
List<WebUri>? otherLikelyURLs,
WebUri? referrer,
@Deprecated('Use settings instead')
// ignore: deprecated_member_use_from_same_package
ChromeSafariBrowserClassOptions? options,
ChromeSafariBrowserSettings? settings}) async {
assert(!_isOpened, 'The browser is already opened.');
_isOpened = true;
if (Util.isIOS) {
assert(url != null, 'The specified URL must not be null on iOS.');
assert(['http', 'https'].contains(url!.scheme),
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
}
if (url != null) {
assert(url.toString().isNotEmpty, 'The specified URL must not be empty.');
}
_init();
List<Map<String, dynamic>> menuItemList = [];
_menuItems.forEach((key, value) {
menuItemList.add(value.toMap());
});
var initialSettings = settings?.toMap() ??
options?.toMap() ??
ChromeSafariBrowserSettings().toMap();
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('id', () => id);
args.putIfAbsent('url', () => url?.toString());
args.putIfAbsent('headers', () => headers);
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
args.putIfAbsent('referrer', () => referrer?.toString());
args.putIfAbsent('settings', () => initialSettings);
args.putIfAbsent('actionButton', () => _actionButton?.toMap());
args.putIfAbsent('secondaryToolbar', () => _secondaryToolbar?.toMap());
args.putIfAbsent('menuItemList', () => menuItemList);
await _staticChannel.invokeMethod('open', args);
}
///Tells the browser to launch with [url].
///
///[url] - initial url.
///
///[headers] (Supported only on Android) - [whitelisted](https://fetch.spec.whatwg.org/#cors-safelisted-request-header) cross-origin request headers.
///It is possible to attach non-whitelisted headers to cross-origin requests, when the server and client are related using a
///[digital asset link](https://developers.google.com/digital-asset-links/v1/getting-started).
///
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order.
///
///[referrer] - referrer header. Supported only on Android.
///
///**Supported Platforms/Implementations**:
///- Android
Future<void> launchUrl({
required WebUri url,
Map<String, String>? headers,
List<WebUri>? otherLikelyURLs,
WebUri? referrer,
}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url.toString());
args.putIfAbsent('headers', () => headers);
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
args.putIfAbsent('referrer', () => referrer?.toString());
await channel?.invokeMethod("launchUrl", args);
}
///Tells the browser of a likely future navigation to a URL.
///The most likely URL has to be specified first.
///Optionally, a list of other likely URLs can be provided.
///They are treated as less likely than the first one, and have to be sorted in decreasing priority order.
///These additional URLs may be ignored. All previous calls to this method will be deprioritized.
///
///[url] - Most likely URL, may be null if otherLikelyBundles is provided.
///
///[otherLikelyURLs] - Other likely destinations, sorted in decreasing likelihood order.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E)))
Future<bool> mayLaunchUrl(
{WebUri? url, List<WebUri>? otherLikelyURLs}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('url', () => url?.toString());
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
return await channel?.invokeMethod<bool>("mayLaunchUrl", args) ?? false;
}
///Requests to validate a relationship between the application and an origin.
///
///See [here](https://developers.google.com/digital-asset-links/v1/getting-started) for documentation about Digital Asset Links.
///This methods requests the browser to verify a relation with the calling application, to grant the associated rights.
///
///If this method returns `true`, the validation result will be provided through [onRelationshipValidationResult].
///Otherwise the request didn't succeed.
///
///[relation] Relation to check, must be one of the [CustomTabsRelationType] constants.
///
///[origin] Origin.
///
///[extras] Reserved for future use.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle)))
Future<bool> validateRelationship(
{required CustomTabsRelationType relation,
required WebUri origin}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('relation', () => relation.toNativeValue());
args.putIfAbsent('origin', () => origin.toString());
return await channel?.invokeMethod<bool>("validateRelationship", args) ??
false;
}
///Closes the [AndroidChromeSafariBrowser] instance.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
Future<void> close() async {
Map<String, dynamic> args = <String, dynamic>{};
await channel?.invokeMethod("close", args);
}
///Set a custom action button.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean)))
void setActionButton(ChromeSafariBrowserActionButton actionButton) {
this._actionButton = actionButton;
}
///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description].
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String)))
Future<void> updateActionButton(
{required Uint8List icon, required String description}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('icon', () => icon);
args.putIfAbsent('description', () => description);
await channel?.invokeMethod("updateActionButton", args);
_actionButton?.icon = icon;
_actionButton?.description = description;
}
///Sets the remote views displayed in the secondary toolbar in a custom tab.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
void setSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
this._secondaryToolbar = secondaryToolbar;
}
///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session.
///
///**NOTE**: Not available in a Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
Future<void> updateSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('secondaryToolbar', () => secondaryToolbar.toMap());
await channel?.invokeMethod("updateSecondaryToolbar", args);
this._secondaryToolbar = secondaryToolbar;
}
///Adds a [ChromeSafariBrowserMenuItem] to the menu.
///
///**NOTE**: Not available in an Android Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
this._menuItems[menuItem.id] = menuItem;
}
///Adds a list of [ChromeSafariBrowserMenuItem] to the menu.
///
///**NOTE**: Not available in an Android Trusted Web Activity.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
void addMenuItems(List<ChromeSafariBrowserMenuItem> menuItems) {
menuItems.forEach((menuItem) {
this._menuItems[menuItem.id] = menuItem;
});
}
///Sends a request to create a two way postMessage channel between the client
///and the browser.
///If you want to specifying the target origin to communicate with, set the [targetOrigin].
///
///[sourceOrigin] - A origin that the client is requesting to be
///identified as during the postMessage communication.
///It has to either start with http or https.
///
///[targetOrigin] - The target Origin to establish the postMessage communication with.
///This can be the app's package name, it has to either start with http or https.
///
///Returns whether the implementation accepted the request.
///Note that returning true here doesn't mean an origin has already been
///assigned as the validation is asynchronous.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle)))
Future<bool> requestPostMessageChannel(
{required WebUri sourceOrigin, WebUri? targetOrigin}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("sourceOrigin", () => sourceOrigin.toString());
args.putIfAbsent("targetOrigin", () => targetOrigin.toString());
return await channel?.invokeMethod<bool>(
"requestPostMessageChannel", args) ??
false;
}
///Sends a postMessage request using the origin communicated via [requestPostMessageChannel].
///Fails when called before [onMessageChannelReady] event.
///
///[message] The message that is being sent.
///
///Returns an integer constant about the postMessage request result.
///Will return CustomTabsService.RESULT_SUCCESS if successful.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)))
Future<CustomTabsPostMessageResultType> postMessage(String message) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("message", () => message);
return CustomTabsPostMessageResultType.fromNativeValue(
await channel?.invokeMethod<int>("postMessage", args)) ??
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
}
///Returns whether the Engagement Signals API is available.
///The availability of the Engagement Signals API may change at runtime.
///If an EngagementSignalsCallback has been set, an [onSessionEnded]
///signal will be sent if the API becomes unavailable later.
///
///Returns whether the Engagement Signals API is available.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle)))
Future<bool> isEngagementSignalsApiAvailable() async {
Map<String, dynamic> args = <String, dynamic>{};
return await channel?.invokeMethod<bool>(
"isEngagementSignalsApiAvailable", args) ??
false;
}
///On Android, returns `true` if Chrome Custom Tabs is available.
///On iOS, returns `true` if SFSafariViewController is available.
///Otherwise returns `false`.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
Future<bool> isAvailable() async {
Map<String, dynamic> args = <String, dynamic>{};
return await _staticChannel.invokeMethod<bool>("isAvailable", args) ??
false;
}
///The maximum number of allowed secondary toolbar items.
///
///**Supported Platforms/Implementations**:
///- Android
Future<int> getMaxToolbarItems() async {
Map<String, dynamic> args = <String, dynamic>{};
return await _staticChannel.invokeMethod<int>("getMaxToolbarItems", args) ??
0;
}
///Returns the preferred package to use for Custom Tabs.
///The preferred package name is the default VIEW intent handler as long as it supports Custom Tabs.
///To modify this preferred behavior, set [ignoreDefault] to `true` and give a
///non empty list of package names in packages.
///This method queries the `PackageManager` to determine which packages support the Custom Tabs API.
///On apps that target Android 11 and above, this requires adding the following
///package visibility elements to your manifest.
///
///[packages] Ordered list of packages to test for Custom Tabs support, in decreasing order of priority.
///
///[ignoreDefault] If set, the default VIEW handler won't get priority over other browsers.
///
///Returns the preferred package name for handling Custom Tabs, or null.
///
///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean))))
Future<String?> getPackageName(
{List<String>? packages, bool ignoreDefault = false}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent("packages", () => packages);
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
return await _staticChannel.invokeMethod<String?>("getPackageName", args);
}
///Clear associated website data accrued from browsing activity within your app.
///This includes all local storage, cached resources, and cookies.
///
///**NOTE for iOS**: available on iOS 16.0+.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata))
Future<void> clearWebsiteData() async {
Map<String, dynamic> args = <String, dynamic>{};
await _staticChannel.invokeMethod("clearWebsiteData", args);
}
///Prewarms a connection to each URL. SFSafariViewController will automatically use a
///prewarmed connection if possible when loading its initial URL.
///
///Returns a token object that corresponds to the requested URLs. You must keep a strong
///reference to this token as long as you expect the prewarmed connections to remain open. If the same
///server is requested in multiple calls to this method, all of the corresponding tokens must be
///invalidated or released to end the prewarmed connection to that server.
///
///This method uses a best-effort approach to prewarming connections, but may delay
///or drop requests based on the volume of requests made by your app. Use this method when you expect
///to present the browser soon. Many HTTP servers time out connections after a few minutes.
///After a timeout, prewarming delivers less performance benefit.
///
///[URLs] - the URLs of servers that the browser should prewarm connections to.
///Only supports URLs with `http://` or `https://` schemes.
///
///**NOTE for iOS**: available on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList());
Map<String, dynamic>? result =
(await _staticChannel.invokeMethod("prewarmConnections", args))
?.cast<String, dynamic>();
return PrewarmingToken.fromMap(result);
}
///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens.
///
///**NOTE for iOS**: available on iOS 15.0+.
///
///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
Future<void> invalidatePrewarmingToken(
PrewarmingToken prewarmingToken) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('prewarmingToken', () => prewarmingToken.toMap());
await _staticChannel.invokeMethod("invalidatePrewarmingToken", args);
}
///Returns `true` if the [AndroidChromeSafariBrowser] instance is opened, otherwise `false`.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
bool isOpened() {
return _isOpened;
}
///Disposes the channel.
@override
@mustCallSuper
void dispose() {
disposeChannel();
}
}

View File

@ -0,0 +1 @@
export 'chrome_safari_browser.dart';

View File

@ -194,7 +194,7 @@ class AndroidCookieManager extends PlatformCookieManager
await controller.evaluateJavascript( await controller.evaluateJavascript(
source: 'document.cookie="$cookieValue"'); source: 'document.cookie="$cookieValue"');
setCookieCompleter.complete(); setCookieCompleter.complete();
}, }
)); ));
await headlessWebView.run(); await headlessWebView.run();
await setCookieCompleter.future; await setCookieCompleter.future;

View File

@ -17,7 +17,8 @@ class AndroidHeadlessInAppWebViewCreationParams
extends PlatformHeadlessInAppWebViewCreationParams { extends PlatformHeadlessInAppWebViewCreationParams {
/// Creates a new [AndroidHeadlessInAppWebViewCreationParams] instance. /// Creates a new [AndroidHeadlessInAppWebViewCreationParams] instance.
AndroidHeadlessInAppWebViewCreationParams( AndroidHeadlessInAppWebViewCreationParams(
{super.initialSize, {super.controllerFromPlatform,
super.initialSize,
super.windowId, super.windowId,
super.onWebViewCreated, super.onWebViewCreated,
super.onLoadStart, super.onLoadStart,
@ -132,6 +133,7 @@ class AndroidHeadlessInAppWebViewCreationParams
AndroidHeadlessInAppWebViewCreationParams.fromPlatformHeadlessInAppWebViewCreationParams( AndroidHeadlessInAppWebViewCreationParams.fromPlatformHeadlessInAppWebViewCreationParams(
PlatformHeadlessInAppWebViewCreationParams params) PlatformHeadlessInAppWebViewCreationParams params)
: this( : this(
controllerFromPlatform: params.controllerFromPlatform,
initialSize: params.initialSize, initialSize: params.initialSize,
windowId: params.windowId, windowId: params.windowId,
onWebViewCreated: params.onWebViewCreated, onWebViewCreated: params.onWebViewCreated,
@ -288,6 +290,8 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
@override @override
AndroidInAppWebViewController? get webViewController => _webViewController; AndroidInAppWebViewController? get webViewController => _webViewController;
dynamic _controllerFromPlatform;
AndroidHeadlessInAppWebViewCreationParams get _androidParams => AndroidHeadlessInAppWebViewCreationParams get _androidParams =>
params as AndroidHeadlessInAppWebViewCreationParams; params as AndroidHeadlessInAppWebViewCreationParams;
@ -296,6 +300,9 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
AndroidInAppWebViewControllerCreationParams( AndroidInAppWebViewControllerCreationParams(
id: id, webviewParams: params), id: id, webviewParams: params),
); );
_controllerFromPlatform =
params.controllerFromPlatform?.call(_webViewController!) ??
_webViewController!;
_androidParams.pullToRefreshController?.init(id); _androidParams.pullToRefreshController?.init(id);
_androidParams.findInteractionController?.init(id); _androidParams.findInteractionController?.init(id);
channel = channel =
@ -308,7 +315,7 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
switch (call.method) { switch (call.method) {
case "onWebViewCreated": case "onWebViewCreated":
if (params.onWebViewCreated != null && _webViewController != null) { if (params.onWebViewCreated != null && _webViewController != null) {
params.onWebViewCreated!(_webViewController!); params.onWebViewCreated!(_controllerFromPlatform);
} }
break; break;
default: default:
@ -478,6 +485,7 @@ class AndroidHeadlessInAppWebView extends PlatformHeadlessInAppWebView
_running = false; _running = false;
_webViewController?.dispose(); _webViewController?.dispose();
_webViewController = null; _webViewController = null;
_controllerFromPlatform = null;
_androidParams.pullToRefreshController?.dispose(); _androidParams.pullToRefreshController?.dispose();
_androidParams.findInteractionController?.dispose(); _androidParams.findInteractionController?.dispose();
} }

View File

@ -19,7 +19,8 @@ import '../pull_to_refresh/pull_to_refresh_controller.dart';
class AndroidInAppWebViewWidgetCreationParams class AndroidInAppWebViewWidgetCreationParams
extends PlatformInAppWebViewWidgetCreationParams { extends PlatformInAppWebViewWidgetCreationParams {
AndroidInAppWebViewWidgetCreationParams( AndroidInAppWebViewWidgetCreationParams(
{super.key, {super.controllerFromPlatform,
super.key,
super.layoutDirection, super.layoutDirection,
super.gestureRecognizers, super.gestureRecognizers,
super.headlessWebView, super.headlessWebView,
@ -140,6 +141,7 @@ class AndroidInAppWebViewWidgetCreationParams
AndroidInAppWebViewWidgetCreationParams.fromPlatformInAppWebViewWidgetCreationParams( AndroidInAppWebViewWidgetCreationParams.fromPlatformInAppWebViewWidgetCreationParams(
PlatformInAppWebViewWidgetCreationParams params) PlatformInAppWebViewWidgetCreationParams params)
: this( : this(
controllerFromPlatform: params.controllerFromPlatform,
key: params.key, key: params.key,
layoutDirection: params.layoutDirection, layoutDirection: params.layoutDirection,
gestureRecognizers: params.gestureRecognizers, gestureRecognizers: params.gestureRecognizers,
@ -320,8 +322,6 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
true; true;
return PlatformViewLink( return PlatformViewLink(
// Setting a default key using `params` ensures the `PlatformViewLink`
// recreates the PlatformView when changes are made.
key: _androidParams.key, key: _androidParams.key,
viewType: 'com.pichillilorenzo/flutter_inappwebview', viewType: 'com.pichillilorenzo/flutter_inappwebview',
surfaceFactory: ( surfaceFactory: (
@ -369,22 +369,6 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
); );
} }
@override
void dispose() {
dynamic viewId = _controller?.getViewId();
debugLog(
className: runtimeType.toString(),
id: viewId?.toString(),
debugLoggingSettings: PlatformInAppWebViewController.debugLoggingSettings,
method: "dispose",
args: []);
final isKeepAlive = _androidParams.keepAlive != null;
_controller?.dispose(isKeepAlive: isKeepAlive);
_controller = null;
_androidParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
_androidParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
}
AndroidViewController _createAndroidViewController({ AndroidViewController _createAndroidViewController({
required bool hybridComposition, required bool hybridComposition,
required int id, required int id,
@ -427,11 +411,12 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
debugLog( debugLog(
className: runtimeType.toString(), className: runtimeType.toString(),
id: viewId?.toString(), id: viewId?.toString(),
debugLoggingSettings: PlatformInAppWebViewController.debugLoggingSettings, debugLoggingSettings:
PlatformInAppWebViewController.debugLoggingSettings,
method: "onWebViewCreated", method: "onWebViewCreated",
args: []); args: []);
if (_androidParams.onWebViewCreated != null) { if (_androidParams.onWebViewCreated != null) {
_androidParams.onWebViewCreated!(_controller!); _androidParams.onWebViewCreated!(params.controllerFromPlatform?.call(_controller!) ?? _controller!);
} }
} }
@ -469,4 +454,27 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
settings.useOnNavigationResponse = true; settings.useOnNavigationResponse = true;
} }
} }
@override
void dispose() {
dynamic viewId = _controller?.getViewId();
debugLog(
className: runtimeType.toString(),
id: viewId?.toString(),
debugLoggingSettings:
PlatformInAppWebViewController.debugLoggingSettings,
method: "dispose",
args: []);
final isKeepAlive = _androidParams.keepAlive != null;
_controller?.dispose(isKeepAlive: isKeepAlive);
_controller = null;
_androidParams.pullToRefreshController?.dispose(isKeepAlive: isKeepAlive);
_androidParams.findInteractionController?.dispose(isKeepAlive: isKeepAlive);
}
@override
T controllerFromPlatform<T>(PlatformInAppWebViewController controller) {
// TODO: implement controllerFromPlatform
throw UnimplementedError();
}
} }

View File

@ -1,6 +1,7 @@
import 'package:flutter_inappwebview_android/src/print_job/main.dart'; import 'package:flutter_inappwebview_android/src/print_job/main.dart';
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart'; import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
import 'chrome_safari_browser/chrome_safari_browser.dart';
import 'cookie_manager.dart'; import 'cookie_manager.dart';
import 'http_auth_credentials_database.dart'; import 'http_auth_credentials_database.dart';
import 'find_interaction/main.dart'; import 'find_interaction/main.dart';
@ -204,8 +205,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [InAppBrowser] in `flutter_inappwebview` instead. /// Look at using [InAppBrowser] in `flutter_inappwebview` instead.
AndroidInAppBrowser createPlatformInAppBrowser( AndroidInAppBrowser createPlatformInAppBrowser(
PlatformInAppBrowserCreationParams params, PlatformInAppBrowserCreationParams params,
) { ) {
return AndroidInAppBrowser(params); return AndroidInAppBrowser(params);
} }
@ -222,8 +223,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [ProcessGlobalConfig] in `flutter_inappwebview` instead. /// Look at using [ProcessGlobalConfig] in `flutter_inappwebview` instead.
AndroidProcessGlobalConfig createPlatformProcessGlobalConfig( AndroidProcessGlobalConfig createPlatformProcessGlobalConfig(
PlatformProcessGlobalConfigCreationParams params, PlatformProcessGlobalConfigCreationParams params,
) { ) {
return AndroidProcessGlobalConfig(params); return AndroidProcessGlobalConfig(params);
} }
@ -232,8 +233,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [ProxyController] in `flutter_inappwebview` instead. /// Look at using [ProxyController] in `flutter_inappwebview` instead.
AndroidProxyController createPlatformProxyController( AndroidProxyController createPlatformProxyController(
PlatformProxyControllerCreationParams params, PlatformProxyControllerCreationParams params,
) { ) {
return AndroidProxyController(params); return AndroidProxyController(params);
} }
@ -242,8 +243,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead. /// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
AndroidServiceWorkerController createPlatformServiceWorkerController( AndroidServiceWorkerController createPlatformServiceWorkerController(
PlatformServiceWorkerControllerCreationParams params, PlatformServiceWorkerControllerCreationParams params,
) { ) {
return AndroidServiceWorkerController(params); return AndroidServiceWorkerController(params);
} }
@ -260,36 +261,18 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [TracingController] in `flutter_inappwebview` instead. /// Look at using [TracingController] in `flutter_inappwebview` instead.
AndroidTracingController createPlatformTracingController( AndroidTracingController createPlatformTracingController(
PlatformTracingControllerCreationParams params, PlatformTracingControllerCreationParams params,
) { ) {
return AndroidTracingController(params); return AndroidTracingController(params);
} }
/// Creates a new [AndroidWebViewAssetLoader].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
AndroidWebViewAssetLoader createPlatformWebViewAssetLoader(
PlatformWebViewAssetLoaderCreationParams params,
) {
return AndroidWebViewAssetLoader(params);
}
/// Creates a new empty [AndroidWebViewAssetLoader] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
AndroidWebViewAssetLoader createAndroidWebViewAssetLoaderStatic() {
return AndroidWebViewAssetLoader.static();
}
/// Creates a new [AndroidPathHandler]. /// Creates a new [AndroidPathHandler].
/// ///
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [PathHandler] in `flutter_inappwebview` instead. /// Look at using [PathHandler] in `flutter_inappwebview` instead.
AndroidPathHandler createPlatformPathHandler( AndroidPathHandler createPlatformPathHandler(
PlatformPathHandlerCreationParams params, PlatformPathHandlerCreationParams params,
) { ) {
return AndroidPathHandler(params); return AndroidPathHandler(params);
} }
@ -298,8 +281,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [AssetsPathHandler] in `flutter_inappwebview` instead. /// Look at using [AssetsPathHandler] in `flutter_inappwebview` instead.
AndroidAssetsPathHandler createPlatformAssetsPathHandler( AndroidAssetsPathHandler createPlatformAssetsPathHandler(
PlatformAssetsPathHandlerCreationParams params, PlatformAssetsPathHandlerCreationParams params,
) { ) {
return AndroidAssetsPathHandler(params); return AndroidAssetsPathHandler(params);
} }
@ -308,8 +291,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [ResourcesPathHandler] in `flutter_inappwebview` instead. /// Look at using [ResourcesPathHandler] in `flutter_inappwebview` instead.
AndroidResourcesPathHandler createPlatformResourcesPathHandler( AndroidResourcesPathHandler createPlatformResourcesPathHandler(
PlatformResourcesPathHandlerCreationParams params, PlatformResourcesPathHandlerCreationParams params,
) { ) {
return AndroidResourcesPathHandler(params); return AndroidResourcesPathHandler(params);
} }
@ -318,8 +301,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [InternalStoragePathHandler] in `flutter_inappwebview` instead. /// Look at using [InternalStoragePathHandler] in `flutter_inappwebview` instead.
AndroidInternalStoragePathHandler createPlatformInternalStoragePathHandler( AndroidInternalStoragePathHandler createPlatformInternalStoragePathHandler(
PlatformInternalStoragePathHandlerCreationParams params, PlatformInternalStoragePathHandlerCreationParams params,
) { ) {
return AndroidInternalStoragePathHandler(params); return AndroidInternalStoragePathHandler(params);
} }
@ -328,8 +311,8 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
/// Look at using [WebViewFeature] in `flutter_inappwebview` instead. /// Look at using [WebViewFeature] in `flutter_inappwebview` instead.
wv.AndroidWebViewFeature createPlatformWebViewFeature( wv.AndroidWebViewFeature createPlatformWebViewFeature(
PlatformWebViewFeatureCreationParams params, PlatformWebViewFeatureCreationParams params,
) { ) {
return wv.AndroidWebViewFeature(params); return wv.AndroidWebViewFeature(params);
} }
@ -340,4 +323,31 @@ class AndroidInAppWebViewPlatform extends InAppWebViewPlatform {
wv.AndroidWebViewFeature createPlatformWebViewFeatureStatic() { wv.AndroidWebViewFeature createPlatformWebViewFeatureStatic() {
return wv.AndroidWebViewFeature.static(); return wv.AndroidWebViewFeature.static();
} }
/// Creates a new [AndroidChromeSafariBrowser].
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
AndroidChromeSafariBrowser createPlatformChromeSafariBrowser(
PlatformChromeSafariBrowserCreationParams params,
) {
return AndroidChromeSafariBrowser(params);
}
/// Creates a new empty [AndroidChromeSafariBrowser] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
AndroidChromeSafariBrowser createPlatformChromeSafariBrowserStatic() {
return AndroidChromeSafariBrowser.static();
}
/// Creates a new empty [AndroidWebStorageManager] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebStorageManager] in `flutter_inappwebview` instead.
AndroidWebStorageManager createPlatformWebStorageManager(
PlatformWebStorageManagerCreationParams params) {
return AndroidWebStorageManager(params);
}
} }

View File

@ -1,7 +1,7 @@
export 'inappwebview_platform.dart'; export 'inappwebview_platform.dart';
export 'in_app_webview/main.dart'; export 'in_app_webview/main.dart';
export 'in_app_browser/main.dart'; export 'in_app_browser/main.dart';
// export 'chrome_safari_browser/main.dart'; export 'chrome_safari_browser/main.dart';
export 'web_storage/main.dart'; export 'web_storage/main.dart';
export 'cookie_manager.dart' hide InternalCookieManager; export 'cookie_manager.dart' hide InternalCookieManager;
export 'http_auth_credentials_database.dart' hide InternalHttpAuthCredentialDatabase; export 'http_auth_credentials_database.dart' hide InternalHttpAuthCredentialDatabase;
@ -13,9 +13,6 @@ export 'service_worker_controller.dart';
export 'webview_feature.dart' export 'webview_feature.dart'
hide InternalWebViewFeature; hide InternalWebViewFeature;
export 'proxy_controller.dart' hide InternalProxyController; export 'proxy_controller.dart' hide InternalProxyController;
export 'webview_asset_loader.dart' export 'webview_asset_loader.dart';
hide
InteranlWebViewAssetLoader,
InteranlPathHandler;
export 'tracing_controller.dart' hide InternalTracingController; export 'tracing_controller.dart' hide InternalTracingController;
export 'process_global_config.dart' hide InternalProcessGlobalConfig; export 'process_global_config.dart' hide InternalProcessGlobalConfig;

View File

@ -2,125 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart'; import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
/// Object specifying creation parameters for creating a [AndroidWebViewAssetLoader].
///
/// When adding additional fields make sure they can be null or have a default
/// value to avoid breaking changes. See [PlatformWebViewAssetLoaderCreationParams] for
/// more information.
@immutable
class AndroidWebViewAssetLoaderCreationParams
extends PlatformWebViewAssetLoaderCreationParams {
/// Creates a new [AndroidWebViewAssetLoaderCreationParams] instance.
const AndroidWebViewAssetLoaderCreationParams(
// This parameter prevents breaking changes later.
// ignore: avoid_unused_constructor_parameters
PlatformWebViewAssetLoaderCreationParams params,
) : super();
/// Creates a [AndroidWebViewAssetLoaderCreationParams] instance based on [PlatformWebViewAssetLoaderCreationParams].
factory AndroidWebViewAssetLoaderCreationParams.fromPlatformWebViewAssetLoaderCreationParams(
PlatformWebViewAssetLoaderCreationParams params) {
return AndroidWebViewAssetLoaderCreationParams(params);
}
}
///Helper class to load local files including application's static assets and resources using http(s):// URLs inside a [WebView] class.
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
///
///For more context about application's assets and resources and how to normally access them please refer to
///[Android Developer Docs: App resources overview](https://developer.android.com/guide/topics/resources/providing-resources).
///
///Using http(s):// URLs to access local resources may conflict with a real website.
///This means that local files should only be hosted on domains your organization owns
///(at paths reserved for this purpose) or the default domain reserved for this: `appassets.androidplatform.net`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
class AndroidWebViewAssetLoader extends PlatformWebViewAssetLoader {
/// Creates a new [AndroidWebViewAssetLoader].
AndroidWebViewAssetLoader(PlatformWebViewAssetLoaderCreationParams params)
: super.implementation(
params is AndroidWebViewAssetLoaderCreationParams
? params
: AndroidWebViewAssetLoaderCreationParams
.fromPlatformWebViewAssetLoaderCreationParams(params),
);
factory AndroidWebViewAssetLoader.static() {
return instance();
}
static AndroidWebViewAssetLoader? _instance;
///Gets the [AndroidWebViewAssetLoader] shared instance.
static AndroidWebViewAssetLoader instance() {
return (_instance != null) ? _instance! : _init();
}
static AndroidWebViewAssetLoader _init() {
_instance = AndroidWebViewAssetLoader(
AndroidWebViewAssetLoaderCreationParams(
const PlatformWebViewAssetLoaderCreationParams()));
return _instance!;
}
///Set the domain under which app assets can be accessed. The default domain is `appassets.androidplatform.net`.
String? get domain => params.domain;
///Allow using the HTTP scheme in addition to HTTPS. The default is to not allow HTTP.
bool? get httpAllowed => params.httpAllowed;
///List of registered path handlers.
///
///[WebViewAssetLoader] will try Path Handlers in the order they're registered,
///and will use whichever is the first to return a non-null.
List<AndroidPathHandler>? get pathHandlers =>
params.pathHandlers as List<AndroidPathHandler>?;
///Gets a possible [AndroidWebViewAssetLoader] instance from a [Map] value.
AndroidWebViewAssetLoader? fromMap(Map<String, dynamic>? map) {
if (map == null) {
return null;
}
final instance = AndroidWebViewAssetLoader(
AndroidWebViewAssetLoaderCreationParams(
PlatformWebViewAssetLoaderCreationParams(
domain: map['domain'],
httpAllowed: map['httpAllowed'],
pathHandlers: map['pathHandlers'] != null
? List<AndroidPathHandler>.from(map['pathHandlers'].map((e) => e))
: null,
)));
return instance;
}
///Converts instance to a map.
Map<String, dynamic> toMap() {
return {
"domain": domain,
"httpAllowed": httpAllowed,
"pathHandlers": pathHandlers?.map((e) => e.toMap()).toList(),
};
}
///Converts instance to a map.
Map<String, dynamic> toJson() {
return toMap();
}
///Returns a copy of WebViewAssetLoader.
AndroidWebViewAssetLoader copy() {
return fromMap(toMap()) ??
AndroidWebViewAssetLoader(AndroidWebViewAssetLoaderCreationParams(
const PlatformWebViewAssetLoaderCreationParams()));
}
@override
String toString() {
return 'AndroidWebViewAssetLoader{domain: $domain, httpAllowed: $httpAllowed, pathHandlers: $pathHandlers}';
}
}
/// Object specifying creation parameters for creating a [AndroidPathHandler]. /// Object specifying creation parameters for creating a [AndroidPathHandler].
/// ///
/// When adding additional fields make sure they can be null or have a default /// When adding additional fields make sure they can be null or have a default
@ -346,4 +227,12 @@ class AndroidInternalStoragePathHandler extends AndroidPathHandler implements Pl
@override @override
String get directory => _internalParams.directory; String get directory => _internalParams.directory;
@override
Map<String, dynamic> toMap() {
return {
...toMap(),
'directory': directory
};
}
} }

View File

@ -1,21 +1,18 @@
import 'dart:async'; import 'dart:async';
import 'dart:collection';
import 'dart:typed_data';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
import '../types/custom_tabs_navigation_event_type.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import '../types/custom_tabs_post_message_result_type.dart';
import '../types/custom_tabs_relation_type.dart';
import '../types/prewarming_token.dart';
import '../util.dart';
import '../debug_logging_settings.dart';
import '../web_uri.dart'; /// Object specifying creation parameters for creating a [PlatformChromeSafariBrowser].
import 'chrome_safari_browser_settings.dart'; ///
import 'chrome_safari_action_button.dart'; /// Platform specific implementations can add additional fields by extending
import 'chrome_safari_browser_menu_item.dart'; /// this class.
import 'chrome_safari_browser_secondary_toolbar.dart'; @immutable
class PlatformChromeSafariBrowserCreationParams {
/// Used by the platform implementation to create a new [PlatformChromeSafariBrowser].
const PlatformChromeSafariBrowserCreationParams();
}
///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android ///This class uses native [Chrome Custom Tabs](https://developer.android.com/reference/android/support/customtabs/package-summary) on Android
///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS. ///and [SFSafariViewController](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller) on iOS.
@ -27,156 +24,62 @@ import 'chrome_safari_browser_secondary_toolbar.dart';
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ///- Android
///- iOS ///- iOS
class PlatformChromeSafariBrowser extends ChannelController { abstract class PlatformChromeSafariBrowser extends PlatformInterface implements Disposable {
///Debug settings. ///Debug settings.
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings(); static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
/// Event handler object that handles the [PlatformChromeSafariBrowser] events.
PlatformChromeSafariBrowserEvents? eventHandler;
///{@template flutter_inappwebview_platform_interface.PlatformChromeSafariBrowser.id}
///View ID used internally. ///View ID used internally.
late final String id; ///@{endtemplate}
String get id {
ChromeSafariBrowserActionButton? _actionButton; throw UnimplementedError(
Map<int, ChromeSafariBrowserMenuItem> _menuItems = new HashMap(); 'id is not implemented on the current platform');
ChromeSafariBrowserSecondaryToolbar? _secondaryToolbar;
bool _isOpened = false;
static const MethodChannel _sharedChannel =
const MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser');
PlatformChromeSafariBrowser() {
id = IdGenerator.generate();
channel =
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id');
handler = _handleMethod;
initMethodCallHandler();
_isOpened = false;
} }
_init() { /// Creates a new [PlatformChromeSafariBrowser]
channel = factory PlatformChromeSafariBrowser(PlatformChromeSafariBrowserCreationParams params) {
MethodChannel('com.pichillilorenzo/flutter_chromesafaribrowser_$id'); assert(
handler = _handleMethod; InAppWebViewPlatform.instance != null,
initMethodCallHandler(); 'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformChromeSafariBrowser chromeSafariBrowser =
InAppWebViewPlatform.instance!.createPlatformChromeSafariBrowser(params);
PlatformInterface.verify(chromeSafariBrowser, _token);
return chromeSafariBrowser;
} }
_debugLog(String method, dynamic args) { /// Creates a new [PlatformChromeSafariBrowser] to access static methods.
debugLog( factory PlatformChromeSafariBrowser.static() {
className: this.runtimeType.toString(), assert(
id: id, InAppWebViewPlatform.instance != null,
debugLoggingSettings: PlatformChromeSafariBrowser.debugLoggingSettings, 'A platform implementation for `flutter_inappwebview` has not been set. Please '
method: method, 'ensure that an implementation of `InAppWebViewPlatform` has been set to '
args: args); '`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformChromeSafariBrowser chromeSafariBrowserStatic =
InAppWebViewPlatform.instance!.createPlatformChromeSafariBrowserStatic();
PlatformInterface.verify(chromeSafariBrowserStatic, _token);
return chromeSafariBrowserStatic;
} }
Future<dynamic> _handleMethod(MethodCall call) async { /// Used by the platform implementation to create a new [PlatformChromeSafariBrowser].
_debugLog(call.method, call.arguments); ///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformChromeSafariBrowser.implementation(this.params) : super(token: _token);
switch (call.method) { static final Object _token = Object();
case "onServiceConnected":
onServiceConnected(); /// The parameters used to initialize the [PlatformChromeSafariBrowser].
break; final PlatformChromeSafariBrowserCreationParams params;
case "onOpened":
onOpened();
break;
case "onCompletedInitialLoad":
final bool? didLoadSuccessfully = call.arguments["didLoadSuccessfully"];
onCompletedInitialLoad(didLoadSuccessfully);
break;
case "onInitialLoadDidRedirect":
final String? url = call.arguments["url"];
final WebUri? uri = url != null ? WebUri(url) : null;
onInitialLoadDidRedirect(uri);
break;
case "onNavigationEvent":
final navigationEvent = CustomTabsNavigationEventType.fromNativeValue(
call.arguments["navigationEvent"]);
onNavigationEvent(navigationEvent);
break;
case "onRelationshipValidationResult":
final relation =
CustomTabsRelationType.fromNativeValue(call.arguments["relation"]);
final requestedOrigin = call.arguments["requestedOrigin"] != null
? WebUri(call.arguments["requestedOrigin"])
: null;
final bool result = call.arguments["result"];
onRelationshipValidationResult(relation, requestedOrigin, result);
break;
case "onWillOpenInBrowser":
onWillOpenInBrowser();
break;
case "onClosed":
_isOpened = false;
dispose();
onClosed();
break;
case "onItemActionPerform":
String url = call.arguments["url"];
String title = call.arguments["title"];
int id = call.arguments["id"].toInt();
if (this._actionButton?.id == id) {
if (this._actionButton?.action != null) {
this._actionButton?.action!(url, title);
}
if (this._actionButton?.onClick != null) {
this._actionButton?.onClick!(WebUri(url), title);
}
} else if (this._menuItems[id] != null) {
if (this._menuItems[id]?.action != null) {
this._menuItems[id]?.action!(url, title);
}
if (this._menuItems[id]?.onClick != null) {
this._menuItems[id]?.onClick!(WebUri(url), title);
}
}
break;
case "onSecondaryItemActionPerform":
final clickableIDs = this._secondaryToolbar?.clickableIDs;
if (clickableIDs != null) {
WebUri? url = call.arguments["url"] != null
? WebUri(call.arguments["url"])
: null;
String name = call.arguments["name"];
for (final clickable in clickableIDs) {
var clickableFullname = clickable.id.name;
if (clickable.id.defType != null &&
!clickableFullname.contains("/")) {
clickableFullname = "${clickable.id.defType}/$clickableFullname";
}
if (clickable.id.defPackage != null &&
!clickableFullname.contains(":")) {
clickableFullname =
"${clickable.id.defPackage}:$clickableFullname";
}
if (clickableFullname == name) {
if (clickable.onClick != null) {
clickable.onClick!(url);
}
break;
}
}
}
break;
case "onMessageChannelReady":
onMessageChannelReady();
break;
case "onPostMessage":
final String message = call.arguments["message"];
onPostMessage(message);
break;
case "onVerticalScrollEvent":
final bool isDirectionUp = call.arguments["isDirectionUp"];
onVerticalScrollEvent(isDirectionUp);
break;
case "onGreatestScrollPercentageIncreased":
final int scrollPercentage = call.arguments["scrollPercentage"];
onGreatestScrollPercentageIncreased(scrollPercentage);
break;
case "onSessionEnded":
final bool didUserInteract = call.arguments["didUserInteract"];
onSessionEnded(didUserInteract);
break;
default:
throw UnimplementedError("Unimplemented ${call.method} method");
}
}
///Opens the [PlatformChromeSafariBrowser] instance with an [url]. ///Opens the [PlatformChromeSafariBrowser] instance with an [url].
/// ///
@ -197,50 +100,16 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ///- Android
///- iOS ///- iOS
Future<void> open( Future<void> open({WebUri? url,
{WebUri? url, Map<String, String>? headers,
Map<String, String>? headers, List<WebUri>? otherLikelyURLs,
List<WebUri>? otherLikelyURLs, WebUri? referrer,
WebUri? referrer, @Deprecated('Use settings instead')
@Deprecated('Use settings instead') // ignore: deprecated_member_use_from_same_package
// ignore: deprecated_member_use_from_same_package ChromeSafariBrowserClassOptions? options,
ChromeSafariBrowserClassOptions? options, ChromeSafariBrowserSettings? settings}) {
ChromeSafariBrowserSettings? settings}) async { throw UnimplementedError(
assert(!_isOpened, 'The browser is already opened.'); 'open is not implemented on the current platform');
_isOpened = true;
if (Util.isIOS) {
assert(url != null, 'The specified URL must not be null on iOS.');
assert(['http', 'https'].contains(url!.scheme),
'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.');
}
if (url != null) {
assert(url.toString().isNotEmpty, 'The specified URL must not be empty.');
}
_init();
List<Map<String, dynamic>> menuItemList = [];
_menuItems.forEach((key, value) {
menuItemList.add(value.toMap());
});
var initialSettings = settings?.toMap() ??
options?.toMap() ??
ChromeSafariBrowserSettings().toMap();
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('id', () => id);
args.putIfAbsent('url', () => url?.toString());
args.putIfAbsent('headers', () => headers);
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
args.putIfAbsent('referrer', () => referrer?.toString());
args.putIfAbsent('settings', () => initialSettings);
args.putIfAbsent('actionButton', () => _actionButton?.toMap());
args.putIfAbsent('secondaryToolbar', () => _secondaryToolbar?.toMap());
args.putIfAbsent('menuItemList', () => menuItemList);
await _sharedChannel.invokeMethod('open', args);
} }
///Tells the browser to launch with [url]. ///Tells the browser to launch with [url].
@ -262,14 +131,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
Map<String, String>? headers, Map<String, String>? headers,
List<WebUri>? otherLikelyURLs, List<WebUri>? otherLikelyURLs,
WebUri? referrer, WebUri? referrer,
}) async { }) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('url', () => url.toString()); 'launchUrl is not implemented on the current platform');
args.putIfAbsent('headers', () => headers);
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
args.putIfAbsent('referrer', () => referrer?.toString());
await channel?.invokeMethod("launchUrl", args);
} }
///Tells the browser of a likely future navigation to a URL. ///Tells the browser of a likely future navigation to a URL.
@ -285,12 +149,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E))) ///- Android ([Official API - CustomTabsSession.mayLaunchUrl](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#mayLaunchUrl(android.net.Uri,android.os.Bundle,java.util.List%3Candroid.os.Bundle%3E)))
Future<bool> mayLaunchUrl( Future<bool> mayLaunchUrl(
{WebUri? url, List<WebUri>? otherLikelyURLs}) async { {WebUri? url, List<WebUri>? otherLikelyURLs}) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('url', () => url?.toString()); 'mayLaunchUrl is not implemented on the current platform');
args.putIfAbsent('otherLikelyURLs',
() => otherLikelyURLs?.map((e) => e.toString()).toList());
return await channel?.invokeMethod<bool>("mayLaunchUrl", args) ?? false;
} }
///Requests to validate a relationship between the application and an origin. ///Requests to validate a relationship between the application and an origin.
@ -309,14 +170,10 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle))) ///- Android ([Official API - CustomTabsSession.validateRelationship](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#validateRelationship(int,android.net.Uri,android.os.Bundle)))
Future<bool> validateRelationship( Future<bool> validateRelationship({required CustomTabsRelationType relation,
{required CustomTabsRelationType relation, required WebUri origin}) {
required WebUri origin}) async { throw UnimplementedError(
Map<String, dynamic> args = <String, dynamic>{}; 'validateRelationship is not implemented on the current platform');
args.putIfAbsent('relation', () => relation.toNativeValue());
args.putIfAbsent('origin', () => origin.toString());
return await channel?.invokeMethod<bool>("validateRelationship", args) ??
false;
} }
///Closes the [PlatformChromeSafariBrowser] instance. ///Closes the [PlatformChromeSafariBrowser] instance.
@ -324,9 +181,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ///- Android
///- iOS ///- iOS
Future<void> close() async { Future<void> close() {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
await channel?.invokeMethod("close", args); 'close is not implemented on the current platform');
} }
///Set a custom action button. ///Set a custom action button.
@ -336,7 +193,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean))) ///- Android ([Official API - CustomTabsIntent.Builder.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setActionButton(android.graphics.Bitmap,%20java.lang.String,%20android.app.PendingIntent,%20boolean)))
void setActionButton(ChromeSafariBrowserActionButton actionButton) { void setActionButton(ChromeSafariBrowserActionButton actionButton) {
this._actionButton = actionButton; throw UnimplementedError(
'setActionButton is not implemented on the current platform');
} }
///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description]. ///Updates the [ChromeSafariBrowserActionButton.icon] and [ChromeSafariBrowserActionButton.description].
@ -346,13 +204,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String))) ///- Android ([Official API - CustomTabsSession.setActionButton](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setActionButton(android.graphics.Bitmap,java.lang.String)))
Future<void> updateActionButton( Future<void> updateActionButton(
{required Uint8List icon, required String description}) async { {required Uint8List icon, required String description}) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('icon', () => icon); 'updateActionButton is not implemented on the current platform');
args.putIfAbsent('description', () => description);
await channel?.invokeMethod("updateActionButton", args);
_actionButton?.icon = icon;
_actionButton?.description = description;
} }
///Sets the remote views displayed in the secondary toolbar in a custom tab. ///Sets the remote views displayed in the secondary toolbar in a custom tab.
@ -363,7 +217,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) ///- Android ([Official API - CustomTabsIntent.Builder.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsIntent.Builder#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
void setSecondaryToolbar( void setSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) { ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
this._secondaryToolbar = secondaryToolbar; throw UnimplementedError(
'setSecondaryToolbar is not implemented on the current platform');
} }
///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session. ///Sets or updates (if already present) the Remote Views of the secondary toolbar in an existing custom tab session.
@ -373,11 +228,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent))) ///- Android ([Official API - CustomTabsSession.setSecondaryToolbarViews](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#setSecondaryToolbarViews(android.widget.RemoteViews,int[],android.app.PendingIntent)))
Future<void> updateSecondaryToolbar( Future<void> updateSecondaryToolbar(
ChromeSafariBrowserSecondaryToolbar secondaryToolbar) async { ChromeSafariBrowserSecondaryToolbar secondaryToolbar) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('secondaryToolbar', () => secondaryToolbar.toMap()); 'updateSecondaryToolbar is not implemented on the current platform');
await channel?.invokeMethod("updateSecondaryToolbar", args);
this._secondaryToolbar = secondaryToolbar;
} }
///Adds a [ChromeSafariBrowserMenuItem] to the menu. ///Adds a [ChromeSafariBrowserMenuItem] to the menu.
@ -388,7 +241,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
///- Android ///- Android
///- iOS ///- iOS
void addMenuItem(ChromeSafariBrowserMenuItem menuItem) { void addMenuItem(ChromeSafariBrowserMenuItem menuItem) {
this._menuItems[menuItem.id] = menuItem; throw UnimplementedError(
'addMenuItem is not implemented on the current platform');
} }
///Adds a list of [ChromeSafariBrowserMenuItem] to the menu. ///Adds a list of [ChromeSafariBrowserMenuItem] to the menu.
@ -399,9 +253,8 @@ class PlatformChromeSafariBrowser extends ChannelController {
///- Android ///- Android
///- iOS ///- iOS
void addMenuItems(List<ChromeSafariBrowserMenuItem> menuItems) { void addMenuItems(List<ChromeSafariBrowserMenuItem> menuItems) {
menuItems.forEach((menuItem) { throw UnimplementedError(
this._menuItems[menuItem.id] = menuItem; 'addMenuItems is not implemented on the current platform');
});
} }
///Sends a request to create a two way postMessage channel between the client ///Sends a request to create a two way postMessage channel between the client
@ -422,13 +275,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle))) ///- Android ([Official API - CustomTabsSession.requestPostMessageChannel](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#requestPostMessageChannel(android.net.Uri,android.net.Uri,android.os.Bundle)))
Future<bool> requestPostMessageChannel( Future<bool> requestPostMessageChannel(
{required WebUri sourceOrigin, WebUri? targetOrigin}) async { {required WebUri sourceOrigin, WebUri? targetOrigin}) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent("sourceOrigin", () => sourceOrigin.toString()); 'requestPostMessageChannel is not implemented on the current platform');
args.putIfAbsent("targetOrigin", () => targetOrigin.toString());
return await channel?.invokeMethod<bool>(
"requestPostMessageChannel", args) ??
false;
} }
///Sends a postMessage request using the origin communicated via [requestPostMessageChannel]. ///Sends a postMessage request using the origin communicated via [requestPostMessageChannel].
@ -441,12 +290,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle))) ///- Android ([Official API - CustomTabsSession.postMessage](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#postMessage(java.lang.String,android.os.Bundle)))
Future<CustomTabsPostMessageResultType> postMessage(String message) async { Future<CustomTabsPostMessageResultType> postMessage(String message) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent("message", () => message); 'postMessage is not implemented on the current platform');
return CustomTabsPostMessageResultType.fromNativeValue(
await channel?.invokeMethod<int>("postMessage", args)) ??
CustomTabsPostMessageResultType.FAILURE_MESSAGING_ERROR;
} }
///Returns whether the Engagement Signals API is available. ///Returns whether the Engagement Signals API is available.
@ -458,11 +304,19 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle))) ///- Android ([Official API - CustomTabsSession.isEngagementSignalsApiAvailable](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsSession#isEngagementSignalsApiAvailable(android.os.Bundle)))
Future<bool> isEngagementSignalsApiAvailable() async { Future<bool> isEngagementSignalsApiAvailable() {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
return await channel?.invokeMethod<bool>( 'isEngagementSignalsApiAvailable is not implemented on the current platform');
"isEngagementSignalsApiAvailable", args) ?? }
false;
///Returns `true` if the [PlatformChromeSafariBrowser] instance is opened, otherwise `false`.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
bool isOpened() {
throw UnimplementedError(
'isOpened is not implemented on the current platform');
} }
///On Android, returns `true` if Chrome Custom Tabs is available. ///On Android, returns `true` if Chrome Custom Tabs is available.
@ -472,20 +326,18 @@ class PlatformChromeSafariBrowser extends ChannelController {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ///- Android
///- iOS ///- iOS
static Future<bool> isAvailable() async { Future<bool> isAvailable() {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
return await _sharedChannel.invokeMethod<bool>("isAvailable", args) ?? 'isAvailable is not implemented on the current platform');
false;
} }
///The maximum number of allowed secondary toolbar items. ///The maximum number of allowed secondary toolbar items.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ///- Android
static Future<int> getMaxToolbarItems() async { Future<int> getMaxToolbarItems() {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
return await _sharedChannel.invokeMethod<int>("getMaxToolbarItems", args) ?? 'getMaxToolbarItems is not implemented on the current platform');
0;
} }
///Returns the preferred package to use for Custom Tabs. ///Returns the preferred package to use for Custom Tabs.
@ -504,12 +356,10 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean)))) ///- Android ([Official API - CustomTabsClient.getPackageName](https://developer.android.com/reference/androidx/browser/customtabs/CustomTabsClient#getPackageName(android.content.Context,java.util.List%3Cjava.lang.String%3E,boolean))))
static Future<String?> getPackageName( Future<String?> getPackageName(
{List<String>? packages, bool ignoreDefault = false}) async { {List<String>? packages, bool ignoreDefault = false}) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent("packages", () => packages); 'getPackageName is not implemented on the current platform');
args.putIfAbsent("ignoreDefault", () => ignoreDefault);
return await _sharedChannel.invokeMethod<String?>("getPackageName", args);
} }
///Clear associated website data accrued from browsing activity within your app. ///Clear associated website data accrued from browsing activity within your app.
@ -519,9 +369,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata)) ///- iOS ([Official API - SFSafariViewController.DataStore.clearWebsiteData](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/datastore/3981117-clearwebsitedata))
static Future<void> clearWebsiteData() async { Future<void> clearWebsiteData() {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
await _sharedChannel.invokeMethod("clearWebsiteData", args); 'clearWebsiteData is not implemented on the current platform');
} }
///Prewarms a connection to each URL. SFSafariViewController will automatically use a ///Prewarms a connection to each URL. SFSafariViewController will automatically use a
@ -544,13 +394,9 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
static Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) async { Future<PrewarmingToken?> prewarmConnections(List<WebUri> URLs) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('URLs', () => URLs.map((e) => e.toString()).toList()); 'prewarmConnections is not implemented on the current platform');
Map<String, dynamic>? result =
(await _sharedChannel.invokeMethod("prewarmConnections", args))
?.cast<String, dynamic>();
return PrewarmingToken.fromMap(result);
} }
///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens. ///Ends all prewarmed connections associated with the token, except for connections that are also kept alive by other tokens.
@ -559,13 +405,21 @@ class PlatformChromeSafariBrowser extends ChannelController {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections)) ///- iOS ([Official API - SFSafariViewController.prewarmConnections](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/3752133-prewarmconnections))
static Future<void> invalidatePrewarmingToken( Future<void> invalidatePrewarmingToken(
PrewarmingToken prewarmingToken) async { PrewarmingToken prewarmingToken) {
Map<String, dynamic> args = <String, dynamic>{}; throw UnimplementedError(
args.putIfAbsent('prewarmingToken', () => prewarmingToken.toMap()); 'invalidatePrewarmingToken is not implemented on the current platform');
await _sharedChannel.invokeMethod("invalidatePrewarmingToken", args);
} }
///Disposes the channel.
@override
void dispose() {
throw UnimplementedError(
'dispose is not implemented on the current platform');
}
}
abstract class PlatformChromeSafariBrowserEvents {
///Event fired when the when connecting from Android Custom Tabs Service. ///Event fired when the when connecting from Android Custom Tabs Service.
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
@ -678,20 +532,4 @@ class PlatformChromeSafariBrowser extends ChannelController {
///- Android ///- Android
///- iOS ///- iOS
void onClosed() {} void onClosed() {}
///Returns `true` if the [PlatformChromeSafariBrowser] instance is opened, otherwise `false`.
///
///**Supported Platforms/Implementations**:
///- Android
///- iOS
bool isOpened() {
return _isOpened;
}
///Disposes the channel.
@override
@mustCallSuper
void dispose() {
disposeChannel();
}
} }

View File

@ -102,7 +102,10 @@ abstract class PlatformInAppBrowser extends PlatformInterface implements Disposa
///WebView Controller that can be used to access the [PlatformInAppWebViewController] API. ///WebView Controller that can be used to access the [PlatformInAppWebViewController] API.
///When [onExit] is fired, this will be `null` and cannot be used anymore. ///When [onExit] is fired, this will be `null` and cannot be used anymore.
///@{endtemplate} ///@{endtemplate}
PlatformInAppWebViewController? get webViewController; PlatformInAppWebViewController? get webViewController {
throw UnimplementedError(
'webViewController is not implemented on the current platform');
}
/// Creates a new [PlatformInAppBrowser] /// Creates a new [PlatformInAppBrowser]
factory PlatformInAppBrowser(PlatformInAppBrowserCreationParams params) { factory PlatformInAppBrowser(PlatformInAppBrowserCreationParams params) {

View File

@ -48,16 +48,6 @@ List<ContentBlocker> _deserializeContentBlockers(
return contentBlockers; return contentBlockers;
} }
Map<String, dynamic>? _serializeWebViewAssetLoader(
PlatformWebViewAssetLoader? webViewAssetLoader) {
return webViewAssetLoader?.toMap();
}
PlatformWebViewAssetLoader? _deserializeWebViewAssetLoader(
Map<String, dynamic>? map) {
return PlatformWebViewAssetLoader.static().fromMap(map);
}
///This class represents all the WebView settings available. ///This class represents all the WebView settings available.
@ExchangeableObject(copyMethod: true) @ExchangeableObject(copyMethod: true)
class InAppWebViewSettings_ { class InAppWebViewSettings_ {
@ -381,10 +371,7 @@ because there isn't any way to make the website data store non-persistent for th
///Use a [WebViewAssetLoader] instance to load local files including application's static assets and resources using http(s):// URLs. ///Use a [WebViewAssetLoader] instance to load local files including application's static assets and resources using http(s):// URLs.
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy. ///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
@SupportedPlatforms(platforms: [AndroidPlatform()]) @SupportedPlatforms(platforms: [AndroidPlatform()])
@ExchangeableObjectProperty( WebViewAssetLoader_? webViewAssetLoader;
serializer: _serializeWebViewAssetLoader,
deserializer: _deserializeWebViewAssetLoader)
PlatformWebViewAssetLoader? webViewAssetLoader;
///Sets the text zoom of the page in percent. The default value is `100`. ///Sets the text zoom of the page in percent. The default value is `100`.
@SupportedPlatforms(platforms: [ @SupportedPlatforms(platforms: [

View File

@ -1170,7 +1170,7 @@ class InAppWebViewSettings {
/// ///
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ///- Android native WebView
PlatformWebViewAssetLoader? webViewAssetLoader; WebViewAssetLoader? webViewAssetLoader;
InAppWebViewSettings( InAppWebViewSettings(
{this.useShouldOverrideUrlLoading, {this.useShouldOverrideUrlLoading,
this.useOnLoadResource, this.useOnLoadResource,
@ -1404,8 +1404,8 @@ class InAppWebViewSettings {
? UtilColor.fromStringRepresentation( ? UtilColor.fromStringRepresentation(
map['verticalScrollbarTrackColor']) map['verticalScrollbarTrackColor'])
: null, : null,
webViewAssetLoader: webViewAssetLoader: WebViewAssetLoader.fromMap(
_deserializeWebViewAssetLoader(map['webViewAssetLoader']), map['webViewAssetLoader']?.cast<String, dynamic>()),
); );
instance.accessibilityIgnoresInvertColors = instance.accessibilityIgnoresInvertColors =
map['accessibilityIgnoresInvertColors']; map['accessibilityIgnoresInvertColors'];
@ -1687,7 +1687,7 @@ class InAppWebViewSettings {
"verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(), "verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(),
"verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(), "verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(),
"verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(), "verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(),
"webViewAssetLoader": _serializeWebViewAssetLoader(webViewAssetLoader), "webViewAssetLoader": webViewAssetLoader?.toMap(),
}; };
} }

View File

@ -17,115 +17,116 @@ class PlatformHeadlessInAppWebViewCreationParams
/// Used by the platform implementation to create a new [PlatformHeadlessInAppWebView]. /// Used by the platform implementation to create a new [PlatformHeadlessInAppWebView].
const PlatformHeadlessInAppWebViewCreationParams( const PlatformHeadlessInAppWebViewCreationParams(
{this.initialSize = const Size(-1, -1), {this.initialSize = const Size(-1, -1),
super.windowId, super.controllerFromPlatform,
super.onWebViewCreated, super.windowId,
super.onLoadStart, super.onWebViewCreated,
super.onLoadStop, super.onLoadStart,
@Deprecated('Use onReceivedError instead') super.onLoadError, super.onLoadStop,
super.onReceivedError, @Deprecated('Use onReceivedError instead') super.onLoadError,
@Deprecated("Use onReceivedHttpError instead") super.onLoadHttpError, super.onReceivedError,
super.onReceivedHttpError, @Deprecated("Use onReceivedHttpError instead") super.onLoadHttpError,
super.onProgressChanged, super.onReceivedHttpError,
super.onConsoleMessage, super.onProgressChanged,
super.shouldOverrideUrlLoading, super.onConsoleMessage,
super.onLoadResource, super.shouldOverrideUrlLoading,
super.onScrollChanged, super.onLoadResource,
@Deprecated('Use onDownloadStartRequest instead') super.onDownloadStart, super.onScrollChanged,
super.onDownloadStartRequest, @Deprecated('Use onDownloadStartRequest instead') super.onDownloadStart,
@Deprecated('Use onLoadResourceWithCustomScheme instead') super.onDownloadStartRequest,
super.onLoadResourceCustomScheme, @Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceWithCustomScheme, super.onLoadResourceCustomScheme,
super.onCreateWindow, super.onLoadResourceWithCustomScheme,
super.onCloseWindow, super.onCreateWindow,
super.onJsAlert, super.onCloseWindow,
super.onJsConfirm, super.onJsAlert,
super.onJsPrompt, super.onJsConfirm,
super.onReceivedHttpAuthRequest, super.onJsPrompt,
super.onReceivedServerTrustAuthRequest, super.onReceivedHttpAuthRequest,
super.onReceivedClientCertRequest, super.onReceivedServerTrustAuthRequest,
@Deprecated('Use FindInteractionController.onFindResultReceived instead') super.onReceivedClientCertRequest,
super.onFindResultReceived, @Deprecated('Use FindInteractionController.onFindResultReceived instead')
super.shouldInterceptAjaxRequest, super.onFindResultReceived,
super.onAjaxReadyStateChange, super.shouldInterceptAjaxRequest,
super.onAjaxProgress, super.onAjaxReadyStateChange,
super.shouldInterceptFetchRequest, super.onAjaxProgress,
super.onUpdateVisitedHistory, super.shouldInterceptFetchRequest,
@Deprecated("Use onPrintRequest instead") super.onPrint, super.onUpdateVisitedHistory,
super.onPrintRequest, @Deprecated("Use onPrintRequest instead") super.onPrint,
super.onLongPressHitTestResult, super.onPrintRequest,
super.onEnterFullscreen, super.onLongPressHitTestResult,
super.onExitFullscreen, super.onEnterFullscreen,
super.onPageCommitVisible, super.onExitFullscreen,
super.onTitleChanged, super.onPageCommitVisible,
super.onWindowFocus, super.onTitleChanged,
super.onWindowBlur, super.onWindowFocus,
super.onOverScrolled, super.onWindowBlur,
super.onZoomScaleChanged, super.onOverScrolled,
@Deprecated('Use onSafeBrowsingHit instead') super.onZoomScaleChanged,
super.androidOnSafeBrowsingHit, @Deprecated('Use onSafeBrowsingHit instead')
super.onSafeBrowsingHit, super.androidOnSafeBrowsingHit,
@Deprecated('Use onPermissionRequest instead') super.onSafeBrowsingHit,
super.androidOnPermissionRequest, @Deprecated('Use onPermissionRequest instead')
super.onPermissionRequest, super.androidOnPermissionRequest,
@Deprecated('Use onGeolocationPermissionsShowPrompt instead') super.onPermissionRequest,
super.androidOnGeolocationPermissionsShowPrompt, @Deprecated('Use onGeolocationPermissionsShowPrompt instead')
super.onGeolocationPermissionsShowPrompt, super.androidOnGeolocationPermissionsShowPrompt,
@Deprecated('Use onGeolocationPermissionsHidePrompt instead') super.onGeolocationPermissionsShowPrompt,
super.androidOnGeolocationPermissionsHidePrompt, @Deprecated('Use onGeolocationPermissionsHidePrompt instead')
super.onGeolocationPermissionsHidePrompt, super.androidOnGeolocationPermissionsHidePrompt,
@Deprecated('Use shouldInterceptRequest instead') super.onGeolocationPermissionsHidePrompt,
super.androidShouldInterceptRequest, @Deprecated('Use shouldInterceptRequest instead')
super.shouldInterceptRequest, super.androidShouldInterceptRequest,
@Deprecated('Use onRenderProcessGone instead') super.shouldInterceptRequest,
super.androidOnRenderProcessGone, @Deprecated('Use onRenderProcessGone instead')
super.onRenderProcessGone, super.androidOnRenderProcessGone,
@Deprecated('Use onRenderProcessResponsive instead') super.onRenderProcessGone,
super.androidOnRenderProcessResponsive, @Deprecated('Use onRenderProcessResponsive instead')
super.onRenderProcessResponsive, super.androidOnRenderProcessResponsive,
@Deprecated('Use onRenderProcessUnresponsive instead') super.onRenderProcessResponsive,
super.androidOnRenderProcessUnresponsive, @Deprecated('Use onRenderProcessUnresponsive instead')
super.onRenderProcessUnresponsive, super.androidOnRenderProcessUnresponsive,
@Deprecated('Use onFormResubmission instead') super.onRenderProcessUnresponsive,
super.androidOnFormResubmission, @Deprecated('Use onFormResubmission instead')
super.onFormResubmission, super.androidOnFormResubmission,
@Deprecated('Use onZoomScaleChanged instead') super.androidOnScaleChanged, super.onFormResubmission,
@Deprecated('Use onReceivedIcon instead') super.androidOnReceivedIcon, @Deprecated('Use onZoomScaleChanged instead') super.androidOnScaleChanged,
super.onReceivedIcon, @Deprecated('Use onReceivedIcon instead') super.androidOnReceivedIcon,
@Deprecated('Use onReceivedTouchIconUrl instead') super.onReceivedIcon,
super.androidOnReceivedTouchIconUrl, @Deprecated('Use onReceivedTouchIconUrl instead')
super.onReceivedTouchIconUrl, super.androidOnReceivedTouchIconUrl,
@Deprecated('Use onJsBeforeUnload instead') super.androidOnJsBeforeUnload, super.onReceivedTouchIconUrl,
super.onJsBeforeUnload, @Deprecated('Use onJsBeforeUnload instead') super.androidOnJsBeforeUnload,
@Deprecated('Use onReceivedLoginRequest instead') super.onJsBeforeUnload,
super.androidOnReceivedLoginRequest, @Deprecated('Use onReceivedLoginRequest instead')
super.onReceivedLoginRequest, super.androidOnReceivedLoginRequest,
super.onPermissionRequestCanceled, super.onReceivedLoginRequest,
super.onRequestFocus, super.onPermissionRequestCanceled,
@Deprecated('Use onWebContentProcessDidTerminate instead') super.onRequestFocus,
super.iosOnWebContentProcessDidTerminate, @Deprecated('Use onWebContentProcessDidTerminate instead')
super.onWebContentProcessDidTerminate, super.iosOnWebContentProcessDidTerminate,
@Deprecated( super.onWebContentProcessDidTerminate,
'Use onDidReceiveServerRedirectForProvisionalNavigation instead') @Deprecated(
super.iosOnDidReceiveServerRedirectForProvisionalNavigation, 'Use onDidReceiveServerRedirectForProvisionalNavigation instead')
super.onDidReceiveServerRedirectForProvisionalNavigation, super.iosOnDidReceiveServerRedirectForProvisionalNavigation,
@Deprecated('Use onNavigationResponse instead') super.onDidReceiveServerRedirectForProvisionalNavigation,
super.iosOnNavigationResponse, @Deprecated('Use onNavigationResponse instead')
super.onNavigationResponse, super.iosOnNavigationResponse,
@Deprecated('Use shouldAllowDeprecatedTLS instead') super.onNavigationResponse,
super.iosShouldAllowDeprecatedTLS, @Deprecated('Use shouldAllowDeprecatedTLS instead')
super.shouldAllowDeprecatedTLS, super.iosShouldAllowDeprecatedTLS,
super.onCameraCaptureStateChanged, super.shouldAllowDeprecatedTLS,
super.onMicrophoneCaptureStateChanged, super.onCameraCaptureStateChanged,
super.onContentSizeChanged, super.onMicrophoneCaptureStateChanged,
super.initialUrlRequest, super.onContentSizeChanged,
super.initialFile, super.initialUrlRequest,
super.initialData, super.initialFile,
@Deprecated('Use initialSettings instead') super.initialOptions, super.initialData,
super.initialSettings, @Deprecated('Use initialSettings instead') super.initialOptions,
super.contextMenu, super.initialSettings,
super.initialUserScripts, super.contextMenu,
super.pullToRefreshController, super.initialUserScripts,
super.findInteractionController}); super.pullToRefreshController,
super.findInteractionController});
///The WebView initial size in pixels. ///The WebView initial size in pixels.
/// ///
@ -154,19 +155,21 @@ class PlatformHeadlessInAppWebViewCreationParams
///- Web ///- Web
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements Disposable { abstract class PlatformHeadlessInAppWebView extends PlatformInterface
implements Disposable {
/// Creates a new [PlatformHeadlessInAppWebView] /// Creates a new [PlatformHeadlessInAppWebView]
factory PlatformHeadlessInAppWebView( factory PlatformHeadlessInAppWebView(
PlatformHeadlessInAppWebViewCreationParams params) { PlatformHeadlessInAppWebViewCreationParams params) {
assert( assert(
InAppWebViewPlatform.instance != null, InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please ' 'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to ' 'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, ' '`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.', '`InAppWebViewPlatform.instance` can be set with your own test implementation.',
); );
final PlatformHeadlessInAppWebView webViewControllerDelegate = final PlatformHeadlessInAppWebView webViewControllerDelegate =
InAppWebViewPlatform.instance!.createPlatformHeadlessInAppWebView(params); InAppWebViewPlatform.instance!
.createPlatformHeadlessInAppWebView(params);
PlatformInterface.verify(webViewControllerDelegate, _token); PlatformInterface.verify(webViewControllerDelegate, _token);
return webViewControllerDelegate; return webViewControllerDelegate;
} }
@ -176,7 +179,8 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
/// Should only be used by platform implementations because they can't extend /// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor. /// a class that only contains a factory constructor.
@protected @protected
PlatformHeadlessInAppWebView.implementation(this.params) : super(token: _token); PlatformHeadlessInAppWebView.implementation(this.params)
: super(token: _token);
static final Object _token = Object(); static final Object _token = Object();
@ -184,12 +188,13 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
final PlatformHeadlessInAppWebViewCreationParams params; final PlatformHeadlessInAppWebViewCreationParams params;
///WebView Controller that can be used to access the [InAppWebViewController] API. ///WebView Controller that can be used to access the [InAppWebViewController] API.
PlatformInAppWebViewController? get webViewController => throw UnimplementedError( PlatformInAppWebViewController? get webViewController =>
'webViewController is not implemented on the current platform'); throw UnimplementedError(
'webViewController is not implemented on the current platform');
///View ID. ///View ID.
String get id => throw UnimplementedError( String get id =>
'id is not implemented on the current platform'); throw UnimplementedError('id is not implemented on the current platform');
///Runs the headless WebView. ///Runs the headless WebView.
/// ///
@ -201,8 +206,7 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
///- Web ///- Web
///- MacOS ///- MacOS
Future<void> run() { Future<void> run() {
throw UnimplementedError( throw UnimplementedError('run is not implemented on the current platform');
'run is not implemented on the current platform');
} }
///Indicates if the headless WebView is running or not. ///Indicates if the headless WebView is running or not.
@ -262,4 +266,3 @@ abstract class PlatformHeadlessInAppWebView extends PlatformInterface implements
'dispose is not implemented on the current platform'); 'dispose is not implemented on the current platform');
} }
} }

View File

@ -8,6 +8,7 @@ import '../types/disposable.dart';
import 'in_app_webview_keep_alive.dart'; import 'in_app_webview_keep_alive.dart';
import 'platform_webview.dart'; import 'platform_webview.dart';
import 'platform_headless_in_app_webview.dart'; import 'platform_headless_in_app_webview.dart';
import 'platform_inappwebview_controller.dart';
/// Object specifying creation parameters for creating a [PlatformInAppWebViewWidget]. /// Object specifying creation parameters for creating a [PlatformInAppWebViewWidget].
/// ///
@ -18,120 +19,121 @@ class PlatformInAppWebViewWidgetCreationParams
/// Used by the platform implementation to create a new [PlatformInAppWebViewWidget]. /// Used by the platform implementation to create a new [PlatformInAppWebViewWidget].
PlatformInAppWebViewWidgetCreationParams( PlatformInAppWebViewWidgetCreationParams(
{this.key, {this.key,
this.layoutDirection, this.layoutDirection,
this.gestureRecognizers, this.gestureRecognizers,
this.headlessWebView, this.headlessWebView,
this.keepAlive, this.keepAlive,
this.preventGestureDelay, this.preventGestureDelay,
super.windowId, super.controllerFromPlatform,
super.onWebViewCreated, super.windowId,
super.onLoadStart, super.onWebViewCreated,
super.onLoadStop, super.onLoadStart,
@Deprecated('Use onReceivedError instead') super.onLoadError, super.onLoadStop,
super.onReceivedError, @Deprecated('Use onReceivedError instead') super.onLoadError,
@Deprecated("Use onReceivedHttpError instead") super.onLoadHttpError, super.onReceivedError,
super.onReceivedHttpError, @Deprecated("Use onReceivedHttpError instead") super.onLoadHttpError,
super.onProgressChanged, super.onReceivedHttpError,
super.onConsoleMessage, super.onProgressChanged,
super.shouldOverrideUrlLoading, super.onConsoleMessage,
super.onLoadResource, super.shouldOverrideUrlLoading,
super.onScrollChanged, super.onLoadResource,
@Deprecated('Use onDownloadStartRequest instead') super.onDownloadStart, super.onScrollChanged,
super.onDownloadStartRequest, @Deprecated('Use onDownloadStartRequest instead') super.onDownloadStart,
@Deprecated('Use onLoadResourceWithCustomScheme instead') super.onDownloadStartRequest,
super.onLoadResourceCustomScheme, @Deprecated('Use onLoadResourceWithCustomScheme instead')
super.onLoadResourceWithCustomScheme, super.onLoadResourceCustomScheme,
super.onCreateWindow, super.onLoadResourceWithCustomScheme,
super.onCloseWindow, super.onCreateWindow,
super.onJsAlert, super.onCloseWindow,
super.onJsConfirm, super.onJsAlert,
super.onJsPrompt, super.onJsConfirm,
super.onReceivedHttpAuthRequest, super.onJsPrompt,
super.onReceivedServerTrustAuthRequest, super.onReceivedHttpAuthRequest,
super.onReceivedClientCertRequest, super.onReceivedServerTrustAuthRequest,
@Deprecated('Use FindInteractionController.onFindResultReceived instead') super.onReceivedClientCertRequest,
super.onFindResultReceived, @Deprecated('Use FindInteractionController.onFindResultReceived instead')
super.shouldInterceptAjaxRequest, super.onFindResultReceived,
super.onAjaxReadyStateChange, super.shouldInterceptAjaxRequest,
super.onAjaxProgress, super.onAjaxReadyStateChange,
super.shouldInterceptFetchRequest, super.onAjaxProgress,
super.onUpdateVisitedHistory, super.shouldInterceptFetchRequest,
@Deprecated("Use onPrintRequest instead") super.onPrint, super.onUpdateVisitedHistory,
super.onPrintRequest, @Deprecated("Use onPrintRequest instead") super.onPrint,
super.onLongPressHitTestResult, super.onPrintRequest,
super.onEnterFullscreen, super.onLongPressHitTestResult,
super.onExitFullscreen, super.onEnterFullscreen,
super.onPageCommitVisible, super.onExitFullscreen,
super.onTitleChanged, super.onPageCommitVisible,
super.onWindowFocus, super.onTitleChanged,
super.onWindowBlur, super.onWindowFocus,
super.onOverScrolled, super.onWindowBlur,
super.onZoomScaleChanged, super.onOverScrolled,
@Deprecated('Use onSafeBrowsingHit instead') super.onZoomScaleChanged,
super.androidOnSafeBrowsingHit, @Deprecated('Use onSafeBrowsingHit instead')
super.onSafeBrowsingHit, super.androidOnSafeBrowsingHit,
@Deprecated('Use onPermissionRequest instead') super.onSafeBrowsingHit,
super.androidOnPermissionRequest, @Deprecated('Use onPermissionRequest instead')
super.onPermissionRequest, super.androidOnPermissionRequest,
@Deprecated('Use onGeolocationPermissionsShowPrompt instead') super.onPermissionRequest,
super.androidOnGeolocationPermissionsShowPrompt, @Deprecated('Use onGeolocationPermissionsShowPrompt instead')
super.onGeolocationPermissionsShowPrompt, super.androidOnGeolocationPermissionsShowPrompt,
@Deprecated('Use onGeolocationPermissionsHidePrompt instead') super.onGeolocationPermissionsShowPrompt,
super.androidOnGeolocationPermissionsHidePrompt, @Deprecated('Use onGeolocationPermissionsHidePrompt instead')
super.onGeolocationPermissionsHidePrompt, super.androidOnGeolocationPermissionsHidePrompt,
@Deprecated('Use shouldInterceptRequest instead') super.onGeolocationPermissionsHidePrompt,
super.androidShouldInterceptRequest, @Deprecated('Use shouldInterceptRequest instead')
super.shouldInterceptRequest, super.androidShouldInterceptRequest,
@Deprecated('Use onRenderProcessGone instead') super.shouldInterceptRequest,
super.androidOnRenderProcessGone, @Deprecated('Use onRenderProcessGone instead')
super.onRenderProcessGone, super.androidOnRenderProcessGone,
@Deprecated('Use onRenderProcessResponsive instead') super.onRenderProcessGone,
super.androidOnRenderProcessResponsive, @Deprecated('Use onRenderProcessResponsive instead')
super.onRenderProcessResponsive, super.androidOnRenderProcessResponsive,
@Deprecated('Use onRenderProcessUnresponsive instead') super.onRenderProcessResponsive,
super.androidOnRenderProcessUnresponsive, @Deprecated('Use onRenderProcessUnresponsive instead')
super.onRenderProcessUnresponsive, super.androidOnRenderProcessUnresponsive,
@Deprecated('Use onFormResubmission instead') super.onRenderProcessUnresponsive,
super.androidOnFormResubmission, @Deprecated('Use onFormResubmission instead')
super.onFormResubmission, super.androidOnFormResubmission,
@Deprecated('Use onZoomScaleChanged instead') super.androidOnScaleChanged, super.onFormResubmission,
@Deprecated('Use onReceivedIcon instead') super.androidOnReceivedIcon, @Deprecated('Use onZoomScaleChanged instead') super.androidOnScaleChanged,
super.onReceivedIcon, @Deprecated('Use onReceivedIcon instead') super.androidOnReceivedIcon,
@Deprecated('Use onReceivedTouchIconUrl instead') super.onReceivedIcon,
super.androidOnReceivedTouchIconUrl, @Deprecated('Use onReceivedTouchIconUrl instead')
super.onReceivedTouchIconUrl, super.androidOnReceivedTouchIconUrl,
@Deprecated('Use onJsBeforeUnload instead') super.androidOnJsBeforeUnload, super.onReceivedTouchIconUrl,
super.onJsBeforeUnload, @Deprecated('Use onJsBeforeUnload instead') super.androidOnJsBeforeUnload,
@Deprecated('Use onReceivedLoginRequest instead') super.onJsBeforeUnload,
super.androidOnReceivedLoginRequest, @Deprecated('Use onReceivedLoginRequest instead')
super.onReceivedLoginRequest, super.androidOnReceivedLoginRequest,
super.onPermissionRequestCanceled, super.onReceivedLoginRequest,
super.onRequestFocus, super.onPermissionRequestCanceled,
@Deprecated('Use onWebContentProcessDidTerminate instead') super.onRequestFocus,
super.iosOnWebContentProcessDidTerminate, @Deprecated('Use onWebContentProcessDidTerminate instead')
super.onWebContentProcessDidTerminate, super.iosOnWebContentProcessDidTerminate,
@Deprecated( super.onWebContentProcessDidTerminate,
'Use onDidReceiveServerRedirectForProvisionalNavigation instead') @Deprecated(
super.iosOnDidReceiveServerRedirectForProvisionalNavigation, 'Use onDidReceiveServerRedirectForProvisionalNavigation instead')
super.onDidReceiveServerRedirectForProvisionalNavigation, super.iosOnDidReceiveServerRedirectForProvisionalNavigation,
@Deprecated('Use onNavigationResponse instead') super.onDidReceiveServerRedirectForProvisionalNavigation,
super.iosOnNavigationResponse, @Deprecated('Use onNavigationResponse instead')
super.onNavigationResponse, super.iosOnNavigationResponse,
@Deprecated('Use shouldAllowDeprecatedTLS instead') super.onNavigationResponse,
super.iosShouldAllowDeprecatedTLS, @Deprecated('Use shouldAllowDeprecatedTLS instead')
super.shouldAllowDeprecatedTLS, super.iosShouldAllowDeprecatedTLS,
super.onCameraCaptureStateChanged, super.shouldAllowDeprecatedTLS,
super.onMicrophoneCaptureStateChanged, super.onCameraCaptureStateChanged,
super.onContentSizeChanged, super.onMicrophoneCaptureStateChanged,
super.initialUrlRequest, super.onContentSizeChanged,
super.initialFile, super.initialUrlRequest,
super.initialData, super.initialFile,
@Deprecated('Use initialSettings instead') super.initialOptions, super.initialData,
super.initialSettings, @Deprecated('Use initialSettings instead') super.initialOptions,
super.contextMenu, super.initialSettings,
super.initialUserScripts, super.contextMenu,
super.pullToRefreshController, super.initialUserScripts,
super.findInteractionController}); super.pullToRefreshController,
super.findInteractionController});
/// Controls how one widget replaces another widget in the tree. /// Controls how one widget replaces another widget in the tree.
/// ///
@ -184,19 +186,18 @@ class PlatformInAppWebViewWidgetCreationParams
/// Interface for a platform implementation of a web view widget. /// Interface for a platform implementation of a web view widget.
abstract class PlatformInAppWebViewWidget extends PlatformInterface abstract class PlatformInAppWebViewWidget extends PlatformInterface
implements Disposable { implements Disposable {
/// Creates a new [PlatformInAppWebViewWidget] /// Creates a new [PlatformInAppWebViewWidget]
factory PlatformInAppWebViewWidget( factory PlatformInAppWebViewWidget(
PlatformInAppWebViewWidgetCreationParams params) { PlatformInAppWebViewWidgetCreationParams params) {
assert( assert(
InAppWebViewPlatform.instance != null, InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please ' 'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to ' 'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`InAppWebViewPlatform.instance` before use. For unit testing, ' '`InAppWebViewPlatform.instance` before use. For unit testing, '
'`InAppWebViewPlatform.instance` can be set with your own test implementation.', '`InAppWebViewPlatform.instance` can be set with your own test implementation.',
); );
final PlatformInAppWebViewWidget webViewWidgetDelegate = final PlatformInAppWebViewWidget webViewWidgetDelegate =
InAppWebViewPlatform.instance!.createPlatformInAppWebViewWidget(params); InAppWebViewPlatform.instance!.createPlatformInAppWebViewWidget(params);
PlatformInterface.verify(webViewWidgetDelegate, _token); PlatformInterface.verify(webViewWidgetDelegate, _token);
return webViewWidgetDelegate; return webViewWidgetDelegate;
} }
@ -219,6 +220,8 @@ abstract class PlatformInAppWebViewWidget extends PlatformInterface
/// Returns a Widget tree that embeds the created web view. /// Returns a Widget tree that embeds the created web view.
Widget build(BuildContext context); Widget build(BuildContext context);
T controllerFromPlatform<T>(PlatformInAppWebViewController controller);
@override @override
void dispose(); void dispose();
} }

View File

@ -16,7 +16,9 @@ import '../print_job/main.dart';
///{@template flutter_inappwebview.WebView} ///{@template flutter_inappwebview.WebView}
///Class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [PlatformInAppBrowser]. ///Class that represents a WebView. Used by [InAppWebView], [HeadlessInAppWebView] and the WebView of [PlatformInAppBrowser].
///{@endtemplate} ///{@endtemplate}
class PlatformWebViewCreationParams { class PlatformWebViewCreationParams<T> {
final T Function(PlatformInAppWebViewController controller)? controllerFromPlatform;
///{@template flutter_inappwebview.WebView.windowId} ///{@template flutter_inappwebview.WebView.windowId}
///The window id of a [CreateWindowAction.windowId]. ///The window id of a [CreateWindowAction.windowId].
/// ///
@ -36,7 +38,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onWebViewCreated; final void Function(T controller)? onWebViewCreated;
///{@template flutter_inappwebview.WebView.onLoadStart} ///{@template flutter_inappwebview.WebView.onLoadStart}
///Event fired when the `WebView` starts to load an [url]. ///Event fired when the `WebView` starts to load an [url].
@ -52,7 +54,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455621-webview))
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, WebUri? url)? final void Function(T controller, WebUri? url)?
onLoadStart; onLoadStart;
///{@template flutter_inappwebview.WebView.onLoadStop} ///{@template flutter_inappwebview.WebView.onLoadStop}
@ -67,12 +69,12 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455629-webview))
///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event)) ///- Web ([Official API - Window.onload](https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, WebUri? url)? final void Function(T controller, WebUri? url)?
onLoadStop; onLoadStop;
///Use [onReceivedError] instead. ///Use [onReceivedError] instead.
@Deprecated("Use onReceivedError instead") @Deprecated("Use onReceivedError instead")
final void Function(PlatformInAppWebViewController controller, Uri? url, int code, final void Function(T controller, Uri? url, int code,
String message)? onLoadError; String message)? onLoadError;
///{@template flutter_inappwebview.WebView.onReceivedError} ///{@template flutter_inappwebview.WebView.onReceivedError}
@ -83,12 +85,12 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455623-webview))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, final void Function(T controller,
WebResourceRequest request, WebResourceError error)? onReceivedError; WebResourceRequest request, WebResourceError error)? onReceivedError;
///Use [onReceivedHttpError] instead. ///Use [onReceivedHttpError] instead.
@Deprecated("Use onReceivedHttpError instead") @Deprecated("Use onReceivedHttpError instead")
final void Function(PlatformInAppWebViewController controller, Uri? url, final void Function(T controller, Uri? url,
int statusCode, String description)? onLoadHttpError; int statusCode, String description)? onLoadHttpError;
///{@template flutter_inappwebview.WebView.onReceivedHttpError} ///{@template flutter_inappwebview.WebView.onReceivedHttpError}
@ -106,7 +108,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, T controller,
WebResourceRequest request, WebResourceRequest request,
WebResourceResponse errorResponse)? onReceivedHttpError; WebResourceResponse errorResponse)? onReceivedHttpError;
@ -118,7 +120,7 @@ class PlatformWebViewCreationParams {
///- iOS ///- iOS
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, int progress)? final void Function(T controller, int progress)?
onProgressChanged; onProgressChanged;
///{@template flutter_inappwebview.WebView.onConsoleMessage} ///{@template flutter_inappwebview.WebView.onConsoleMessage}
@ -133,7 +135,7 @@ class PlatformWebViewCreationParams {
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, ConsoleMessage consoleMessage)? T controller, ConsoleMessage consoleMessage)?
onConsoleMessage; onConsoleMessage;
///{@template flutter_inappwebview.WebView.shouldOverrideUrlLoading} ///{@template flutter_inappwebview.WebView.shouldOverrideUrlLoading}
@ -156,7 +158,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455641-webview))
///{@endtemplate} ///{@endtemplate}
final Future<NavigationActionPolicy?> Function( final Future<NavigationActionPolicy?> Function(
PlatformInAppWebViewController controller, NavigationAction navigationAction)? T controller, NavigationAction navigationAction)?
shouldOverrideUrlLoading; shouldOverrideUrlLoading;
///{@template flutter_inappwebview.WebView.onLoadResource} ///{@template flutter_inappwebview.WebView.onLoadResource}
@ -170,7 +172,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, LoadedResource resource)? T controller, LoadedResource resource)?
onLoadResource; onLoadResource;
///{@template flutter_inappwebview.WebView.onScrollChanged} ///{@template flutter_inappwebview.WebView.onScrollChanged}
@ -190,12 +192,12 @@ class PlatformWebViewCreationParams {
///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll)) ///- Web ([Official API - Window.onscroll](https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onscroll))
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, int x, int y)? final void Function(T controller, int x, int y)?
onScrollChanged; onScrollChanged;
///Use [onDownloadStartRequest] instead ///Use [onDownloadStartRequest] instead
@Deprecated('Use onDownloadStartRequest instead') @Deprecated('Use onDownloadStartRequest instead')
final void Function(PlatformInAppWebViewController controller, Uri url)? final void Function(T controller, Uri url)?
onDownloadStart; onDownloadStart;
///{@template flutter_inappwebview.WebView.onDownloadStartRequest} ///{@template flutter_inappwebview.WebView.onDownloadStartRequest}
@ -211,13 +213,13 @@ class PlatformWebViewCreationParams {
///- iOS ///- iOS
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, final void Function(T controller,
DownloadStartRequest downloadStartRequest)? onDownloadStartRequest; DownloadStartRequest downloadStartRequest)? onDownloadStartRequest;
///Use [onLoadResourceWithCustomScheme] instead. ///Use [onLoadResourceWithCustomScheme] instead.
@Deprecated('Use onLoadResourceWithCustomScheme instead') @Deprecated('Use onLoadResourceWithCustomScheme instead')
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
PlatformInAppWebViewController controller, Uri url)? onLoadResourceCustomScheme; T controller, Uri url)? onLoadResourceCustomScheme;
///{@template flutter_inappwebview.WebView.onLoadResourceWithCustomScheme} ///{@template flutter_inappwebview.WebView.onLoadResourceWithCustomScheme}
///Event fired when the `WebView` finds the `custom-scheme` while loading a resource. ///Event fired when the `WebView` finds the `custom-scheme` while loading a resource.
@ -229,7 +231,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler)) ///- MacOS ([Official API - WKURLSchemeHandler](https://developer.apple.com/documentation/webkit/wkurlschemehandler))
///{@endtemplate} ///{@endtemplate}
final Future<CustomSchemeResponse?> Function( final Future<CustomSchemeResponse?> Function(
PlatformInAppWebViewController controller, WebResourceRequest request)? T controller, WebResourceRequest request)?
onLoadResourceWithCustomScheme; onLoadResourceWithCustomScheme;
///{@template flutter_inappwebview.WebView.onCreateWindow} ///{@template flutter_inappwebview.WebView.onCreateWindow}
@ -271,7 +273,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536907-webview))
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final Future<bool?> Function(PlatformInAppWebViewController controller, final Future<bool?> Function(T controller,
CreateWindowAction createWindowAction)? onCreateWindow; CreateWindowAction createWindowAction)? onCreateWindow;
///{@template flutter_inappwebview.WebView.onCloseWindow} ///{@template flutter_inappwebview.WebView.onCloseWindow}
@ -283,7 +285,7 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) ///- iOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose)) ///- MacOS ([Official API - WKUIDelegate.webViewDidClose](https://developer.apple.com/documentation/webkit/wkuidelegate/1537390-webviewdidclose))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onCloseWindow; final void Function(T controller)? onCloseWindow;
///{@template flutter_inappwebview.WebView.onWindowFocus} ///{@template flutter_inappwebview.WebView.onWindowFocus}
///Event fired when the JavaScript `window` object of the WebView has received focus. ///Event fired when the JavaScript `window` object of the WebView has received focus.
@ -297,7 +299,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event)) ///- Web ([Official API - Window.onfocus](https://developer.mozilla.org/en-US/docs/Web/API/Window/focus_event))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onWindowFocus; final void Function(T controller)? onWindowFocus;
///{@template flutter_inappwebview.WebView.onWindowBlur} ///{@template flutter_inappwebview.WebView.onWindowBlur}
///Event fired when the JavaScript `window` object of the WebView has lost focus. ///Event fired when the JavaScript `window` object of the WebView has lost focus.
@ -311,7 +313,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event)) ///- Web ([Official API - Window.onblur](https://developer.mozilla.org/en-US/docs/Web/API/Window/blur_event))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onWindowBlur; final void Function(T controller)? onWindowBlur;
///{@template flutter_inappwebview.WebView.onJsAlert} ///{@template flutter_inappwebview.WebView.onJsAlert}
///Event fired when javascript calls the `alert()` method to display an alert dialog. ///Event fired when javascript calls the `alert()` method to display an alert dialog.
@ -325,7 +327,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1537406-webview))
///{@endtemplate} ///{@endtemplate}
final Future<JsAlertResponse?> Function( final Future<JsAlertResponse?> Function(
PlatformInAppWebViewController controller, JsAlertRequest jsAlertRequest)? T controller, JsAlertRequest jsAlertRequest)?
onJsAlert; onJsAlert;
///{@template flutter_inappwebview.WebView.onJsConfirm} ///{@template flutter_inappwebview.WebView.onJsConfirm}
@ -340,7 +342,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1536489-webview))
///{@endtemplate} ///{@endtemplate}
final Future<JsConfirmResponse?> Function( final Future<JsConfirmResponse?> Function(
PlatformInAppWebViewController controller, JsConfirmRequest jsConfirmRequest)? T controller, JsConfirmRequest jsConfirmRequest)?
onJsConfirm; onJsConfirm;
///{@template flutter_inappwebview.WebView.onJsPrompt} ///{@template flutter_inappwebview.WebView.onJsPrompt}
@ -355,7 +357,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview)) ///- MacOS ([Official API - WKUIDelegate.webView](https://developer.apple.com/documentation/webkit/wkuidelegate/1538086-webview))
///{@endtemplate} ///{@endtemplate}
final Future<JsPromptResponse?> Function( final Future<JsPromptResponse?> Function(
PlatformInAppWebViewController controller, JsPromptRequest jsPromptRequest)? T controller, JsPromptRequest jsPromptRequest)?
onJsPrompt; onJsPrompt;
///{@template flutter_inappwebview.WebView.onReceivedHttpAuthRequest} ///{@template flutter_inappwebview.WebView.onReceivedHttpAuthRequest}
@ -368,7 +370,7 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate} ///{@endtemplate}
final Future<HttpAuthResponse?> Function(PlatformInAppWebViewController controller, final Future<HttpAuthResponse?> Function(T controller,
HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest; HttpAuthenticationChallenge challenge)? onReceivedHttpAuthRequest;
///{@template flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest} ///{@template flutter_inappwebview.WebView.onReceivedServerTrustAuthRequest}
@ -383,7 +385,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate} ///{@endtemplate}
final Future<ServerTrustAuthResponse?> Function( final Future<ServerTrustAuthResponse?> Function(
PlatformInAppWebViewController controller, ServerTrustChallenge challenge)? T controller, ServerTrustChallenge challenge)?
onReceivedServerTrustAuthRequest; onReceivedServerTrustAuthRequest;
///{@template flutter_inappwebview.WebView.onReceivedClientCertRequest} ///{@template flutter_inappwebview.WebView.onReceivedClientCertRequest}
@ -400,12 +402,12 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455638-webview))
///{@endtemplate} ///{@endtemplate}
final Future<ClientCertResponse?> Function( final Future<ClientCertResponse?> Function(
PlatformInAppWebViewController controller, ClientCertChallenge challenge)? T controller, ClientCertChallenge challenge)?
onReceivedClientCertRequest; onReceivedClientCertRequest;
///Use [FindInteractionController.onFindResultReceived] instead. ///Use [FindInteractionController.onFindResultReceived] instead.
@Deprecated('Use FindInteractionController.onFindResultReceived instead') @Deprecated('Use FindInteractionController.onFindResultReceived instead')
final void Function(PlatformInAppWebViewController controller, int activeMatchOrdinal, final void Function(T controller, int activeMatchOrdinal,
int numberOfMatches, bool isDoneCounting)? onFindResultReceived; int numberOfMatches, bool isDoneCounting)? onFindResultReceived;
///{@template flutter_inappwebview.WebView.shouldInterceptAjaxRequest} ///{@template flutter_inappwebview.WebView.shouldInterceptAjaxRequest}
@ -426,7 +428,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<AjaxRequest?> Function( final Future<AjaxRequest?> Function(
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)? T controller, AjaxRequest ajaxRequest)?
shouldInterceptAjaxRequest; shouldInterceptAjaxRequest;
///{@template flutter_inappwebview.WebView.onAjaxReadyStateChange} ///{@template flutter_inappwebview.WebView.onAjaxReadyStateChange}
@ -447,7 +449,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<AjaxRequestAction?> Function( final Future<AjaxRequestAction?> Function(
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)? T controller, AjaxRequest ajaxRequest)?
onAjaxReadyStateChange; onAjaxReadyStateChange;
///{@template flutter_inappwebview.WebView.onAjaxProgress} ///{@template flutter_inappwebview.WebView.onAjaxProgress}
@ -468,7 +470,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<AjaxRequestAction?> Function( final Future<AjaxRequestAction?> Function(
PlatformInAppWebViewController controller, AjaxRequest ajaxRequest)? T controller, AjaxRequest ajaxRequest)?
onAjaxProgress; onAjaxProgress;
///{@template flutter_inappwebview.WebView.shouldInterceptFetchRequest} ///{@template flutter_inappwebview.WebView.shouldInterceptFetchRequest}
@ -489,7 +491,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<FetchRequest?> Function( final Future<FetchRequest?> Function(
PlatformInAppWebViewController controller, FetchRequest fetchRequest)? T controller, FetchRequest fetchRequest)?
shouldInterceptFetchRequest; shouldInterceptFetchRequest;
///{@template flutter_inappwebview.WebView.onUpdateVisitedHistory} ///{@template flutter_inappwebview.WebView.onUpdateVisitedHistory}
@ -511,12 +513,12 @@ class PlatformWebViewCreationParams {
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, WebUri? url, bool? isReload)? T controller, WebUri? url, bool? isReload)?
onUpdateVisitedHistory; onUpdateVisitedHistory;
///Use [onPrintRequest] instead ///Use [onPrintRequest] instead
@Deprecated("Use onPrintRequest instead") @Deprecated("Use onPrintRequest instead")
final void Function(PlatformInAppWebViewController controller, Uri? url)? onPrint; final void Function(T controller, Uri? url)? onPrint;
///{@template flutter_inappwebview.WebView.onPrintRequest} ///{@template flutter_inappwebview.WebView.onPrintRequest}
///Event fired when `window.print()` is called from JavaScript side. ///Event fired when `window.print()` is called from JavaScript side.
@ -536,7 +538,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final Future<bool?> Function(PlatformInAppWebViewController controller, WebUri? url, final Future<bool?> Function(T controller, WebUri? url,
PlatformPrintJobController? printJobController)? onPrintRequest; PlatformPrintJobController? printJobController)? onPrintRequest;
///{@template flutter_inappwebview.WebView.onLongPressHitTestResult} ///{@template flutter_inappwebview.WebView.onLongPressHitTestResult}
@ -548,7 +550,7 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener))) ///- Android native WebView ([Official API - View.setOnLongClickListener](https://developer.android.com/reference/android/view/View#setOnLongClickListener(android.view.View.OnLongClickListener)))
///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer)) ///- iOS ([Official API - UILongPressGestureRecognizer](https://developer.apple.com/documentation/uikit/uilongpressgesturerecognizer))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, final void Function(T controller,
InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult; InAppWebViewHitTestResult hitTestResult)? onLongPressHitTestResult;
///{@template flutter_inappwebview.WebView.onEnterFullscreen} ///{@template flutter_inappwebview.WebView.onEnterFullscreen}
@ -560,7 +562,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification)) ///- MacOS ([Official API - NSWindow.didEnterFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419651-didenterfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event)) ///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onEnterFullscreen; final void Function(T controller)? onEnterFullscreen;
///{@template flutter_inappwebview.WebView.onExitFullscreen} ///{@template flutter_inappwebview.WebView.onExitFullscreen}
///Event fired when the current page has exited full screen mode. ///Event fired when the current page has exited full screen mode.
@ -575,7 +577,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification)) ///- MacOS ([Official API - NSWindow.didExitFullScreenNotification](https://developer.apple.com/documentation/appkit/nswindow/1419177-didexitfullscreennotification))
///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event)) ///- Web ([Official API - Document.onfullscreenchange](https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenchange_event))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onExitFullscreen; final void Function(T controller)? onExitFullscreen;
///{@template flutter_inappwebview.WebView.onPageCommitVisible} ///{@template flutter_inappwebview.WebView.onPageCommitVisible}
///Called when the web view begins to receive web content. ///Called when the web view begins to receive web content.
@ -590,7 +592,7 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455635-webview))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, WebUri? url)? final void Function(T controller, WebUri? url)?
onPageCommitVisible; onPageCommitVisible;
///{@template flutter_inappwebview.WebView.onTitleChanged} ///{@template flutter_inappwebview.WebView.onTitleChanged}
@ -606,7 +608,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, String? title)? final void Function(T controller, String? title)?
onTitleChanged; onTitleChanged;
///{@template flutter_inappwebview.WebView.onOverScrolled} ///{@template flutter_inappwebview.WebView.onOverScrolled}
@ -624,7 +626,7 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean))) ///- Android native WebView ([Official API - WebView.onOverScrolled](https://developer.android.com/reference/android/webkit/WebView#onOverScrolled(int,%20int,%20boolean,%20boolean)))
///- iOS ///- iOS
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, int x, int y, final void Function(T controller, int x, int y,
bool clampedX, bool clampedY)? onOverScrolled; bool clampedX, bool clampedY)? onOverScrolled;
///{@template flutter_inappwebview.WebView.onZoomScaleChanged} ///{@template flutter_inappwebview.WebView.onZoomScaleChanged}
@ -642,13 +644,13 @@ class PlatformWebViewCreationParams {
///- Web ///- Web
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, double oldScale, double newScale)? T controller, double oldScale, double newScale)?
onZoomScaleChanged; onZoomScaleChanged;
///Use [onSafeBrowsingHit] instead. ///Use [onSafeBrowsingHit] instead.
@Deprecated("Use onSafeBrowsingHit instead") @Deprecated("Use onSafeBrowsingHit instead")
final Future<SafeBrowsingResponse?> Function( final Future<SafeBrowsingResponse?> Function(
PlatformInAppWebViewController controller, T controller,
Uri url, Uri url,
SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit; SafeBrowsingThreat? threatType)? androidOnSafeBrowsingHit;
@ -666,14 +668,14 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse))) ///- Android native WebView ([Official API - WebViewClient.onSafeBrowsingHit](https://developer.android.com/reference/android/webkit/WebViewClient#onSafeBrowsingHit(android.webkit.WebView,%20android.webkit.WebResourceRequest,%20int,%20android.webkit.SafeBrowsingResponse)))
///{@endtemplate} ///{@endtemplate}
final Future<SafeBrowsingResponse?> Function( final Future<SafeBrowsingResponse?> Function(
PlatformInAppWebViewController controller, T controller,
WebUri url, WebUri url,
SafeBrowsingThreat? threatType)? onSafeBrowsingHit; SafeBrowsingThreat? threatType)? onSafeBrowsingHit;
///Use [onPermissionRequest] instead. ///Use [onPermissionRequest] instead.
@Deprecated("Use onPermissionRequest instead") @Deprecated("Use onPermissionRequest instead")
final Future<PermissionRequestResponse?> Function( final Future<PermissionRequestResponse?> Function(
PlatformInAppWebViewController controller, T controller,
String origin, String origin,
List<String> resources)? androidOnPermissionRequest; List<String> resources)? androidOnPermissionRequest;
@ -694,13 +696,13 @@ class PlatformWebViewCreationParams {
///- iOS ///- iOS
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<PermissionResponse?> Function(PlatformInAppWebViewController controller, final Future<PermissionResponse?> Function(T controller,
PermissionRequest permissionRequest)? onPermissionRequest; PermissionRequest permissionRequest)? onPermissionRequest;
///Use [onGeolocationPermissionsShowPrompt] instead. ///Use [onGeolocationPermissionsShowPrompt] instead.
@Deprecated("Use onGeolocationPermissionsShowPrompt instead") @Deprecated("Use onGeolocationPermissionsShowPrompt instead")
final Future<GeolocationPermissionShowPromptResponse?> Function( final Future<GeolocationPermissionShowPromptResponse?> Function(
PlatformInAppWebViewController controller, String origin)? T controller, String origin)?
androidOnGeolocationPermissionsShowPrompt; androidOnGeolocationPermissionsShowPrompt;
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt} ///{@template flutter_inappwebview.WebView.onGeolocationPermissionsShowPrompt}
@ -714,12 +716,12 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback))) ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsShowPrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsShowPrompt(java.lang.String,%20android.webkit.GeolocationPermissions.Callback)))
///{@endtemplate} ///{@endtemplate}
final Future<GeolocationPermissionShowPromptResponse?> Function( final Future<GeolocationPermissionShowPromptResponse?> Function(
PlatformInAppWebViewController controller, String origin)? T controller, String origin)?
onGeolocationPermissionsShowPrompt; onGeolocationPermissionsShowPrompt;
///Use [onGeolocationPermissionsHidePrompt] instead. ///Use [onGeolocationPermissionsHidePrompt] instead.
@Deprecated("Use onGeolocationPermissionsHidePrompt instead") @Deprecated("Use onGeolocationPermissionsHidePrompt instead")
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
androidOnGeolocationPermissionsHidePrompt; androidOnGeolocationPermissionsHidePrompt;
///{@template flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt} ///{@template flutter_inappwebview.WebView.onGeolocationPermissionsHidePrompt}
@ -729,13 +731,13 @@ class PlatformWebViewCreationParams {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt())) ///- Android native WebView ([Official API - WebChromeClient.onGeolocationPermissionsHidePrompt](https://developer.android.com/reference/android/webkit/WebChromeClient#onGeolocationPermissionsHidePrompt()))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
onGeolocationPermissionsHidePrompt; onGeolocationPermissionsHidePrompt;
///Use [shouldInterceptRequest] instead. ///Use [shouldInterceptRequest] instead.
@Deprecated("Use shouldInterceptRequest instead") @Deprecated("Use shouldInterceptRequest instead")
final Future<WebResourceResponse?> Function( final Future<WebResourceResponse?> Function(
PlatformInAppWebViewController controller, WebResourceRequest request)? T controller, WebResourceRequest request)?
androidShouldInterceptRequest; androidShouldInterceptRequest;
///{@template flutter_inappwebview.WebView.shouldInterceptRequest} ///{@template flutter_inappwebview.WebView.shouldInterceptRequest}
@ -757,13 +759,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest))) ///- Android native WebView ([Official API - WebViewClient.shouldInterceptRequest](https://developer.android.com/reference/android/webkit/WebViewClient#shouldInterceptRequest(android.webkit.WebView,%20android.webkit.WebResourceRequest)))
///{@endtemplate} ///{@endtemplate}
final Future<WebResourceResponse?> Function( final Future<WebResourceResponse?> Function(
PlatformInAppWebViewController controller, WebResourceRequest request)? T controller, WebResourceRequest request)?
shouldInterceptRequest; shouldInterceptRequest;
///Use [onRenderProcessUnresponsive] instead. ///Use [onRenderProcessUnresponsive] instead.
@Deprecated("Use onRenderProcessUnresponsive instead") @Deprecated("Use onRenderProcessUnresponsive instead")
final Future<WebViewRenderProcessAction?> Function( final Future<WebViewRenderProcessAction?> Function(
PlatformInAppWebViewController controller, Uri? url)? T controller, Uri? url)?
androidOnRenderProcessUnresponsive; androidOnRenderProcessUnresponsive;
///{@template flutter_inappwebview.WebView.onRenderProcessUnresponsive} ///{@template flutter_inappwebview.WebView.onRenderProcessUnresponsive}
@ -788,13 +790,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessUnresponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessUnresponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
///{@endtemplate} ///{@endtemplate}
final Future<WebViewRenderProcessAction?> Function( final Future<WebViewRenderProcessAction?> Function(
PlatformInAppWebViewController controller, WebUri? url)? T controller, WebUri? url)?
onRenderProcessUnresponsive; onRenderProcessUnresponsive;
///Use [onRenderProcessResponsive] instead. ///Use [onRenderProcessResponsive] instead.
@Deprecated("Use onRenderProcessResponsive instead") @Deprecated("Use onRenderProcessResponsive instead")
final Future<WebViewRenderProcessAction?> Function( final Future<WebViewRenderProcessAction?> Function(
PlatformInAppWebViewController controller, Uri? url)? T controller, Uri? url)?
androidOnRenderProcessResponsive; androidOnRenderProcessResponsive;
///{@template flutter_inappwebview.WebView.onRenderProcessResponsive} ///{@template flutter_inappwebview.WebView.onRenderProcessResponsive}
@ -812,13 +814,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess))) ///- Android native WebView ([Official API - WebViewRenderProcessClient.onRenderProcessResponsive](https://developer.android.com/reference/android/webkit/WebViewRenderProcessClient#onRenderProcessResponsive(android.webkit.WebView,%20android.webkit.WebViewRenderProcess)))
///{@endtemplate} ///{@endtemplate}
final Future<WebViewRenderProcessAction?> Function( final Future<WebViewRenderProcessAction?> Function(
PlatformInAppWebViewController controller, WebUri? url)? T controller, WebUri? url)?
onRenderProcessResponsive; onRenderProcessResponsive;
///Use [onRenderProcessGone] instead. ///Use [onRenderProcessGone] instead.
@Deprecated("Use onRenderProcessGone instead") @Deprecated("Use onRenderProcessGone instead")
final void Function( final void Function(
PlatformInAppWebViewController controller, RenderProcessGoneDetail detail)? T controller, RenderProcessGoneDetail detail)?
androidOnRenderProcessGone; androidOnRenderProcessGone;
///{@template flutter_inappwebview.WebView.onRenderProcessGone} ///{@template flutter_inappwebview.WebView.onRenderProcessGone}
@ -834,13 +836,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail))) ///- Android native WebView ([Official API - WebViewClient.onRenderProcessGone](https://developer.android.com/reference/android/webkit/WebViewClient#onRenderProcessGone(android.webkit.WebView,%20android.webkit.RenderProcessGoneDetail)))
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, RenderProcessGoneDetail detail)? T controller, RenderProcessGoneDetail detail)?
onRenderProcessGone; onRenderProcessGone;
///Use [onFormResubmission] instead. ///Use [onFormResubmission] instead.
@Deprecated('Use onFormResubmission instead') @Deprecated('Use onFormResubmission instead')
final Future<FormResubmissionAction?> Function( final Future<FormResubmissionAction?> Function(
PlatformInAppWebViewController controller, Uri? url)? androidOnFormResubmission; T controller, Uri? url)? androidOnFormResubmission;
///{@template flutter_inappwebview.WebView.onFormResubmission} ///{@template flutter_inappwebview.WebView.onFormResubmission}
///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data. ///As the host application if the browser should resend data as the requested page was a result of a POST. The default is to not resend the data.
@ -849,17 +851,17 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message))) ///- Android native WebView ([Official API - WebViewClient.onFormResubmission](https://developer.android.com/reference/android/webkit/WebViewClient#onFormResubmission(android.webkit.WebView,%20android.os.Message,%20android.os.Message)))
///{@endtemplate} ///{@endtemplate}
final Future<FormResubmissionAction?> Function( final Future<FormResubmissionAction?> Function(
PlatformInAppWebViewController controller, WebUri? url)? onFormResubmission; T controller, WebUri? url)? onFormResubmission;
///Use [onZoomScaleChanged] instead. ///Use [onZoomScaleChanged] instead.
@Deprecated('Use onZoomScaleChanged instead') @Deprecated('Use onZoomScaleChanged instead')
final void Function( final void Function(
PlatformInAppWebViewController controller, double oldScale, double newScale)? T controller, double oldScale, double newScale)?
androidOnScaleChanged; androidOnScaleChanged;
///Use [onReceivedIcon] instead. ///Use [onReceivedIcon] instead.
@Deprecated('Use onReceivedIcon instead') @Deprecated('Use onReceivedIcon instead')
final void Function(PlatformInAppWebViewController controller, Uint8List icon)? final void Function(T controller, Uint8List icon)?
androidOnReceivedIcon; androidOnReceivedIcon;
///{@template flutter_inappwebview.WebView.onReceivedIcon} ///{@template flutter_inappwebview.WebView.onReceivedIcon}
@ -870,13 +872,13 @@ class PlatformWebViewCreationParams {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap))) ///- Android native WebView ([Official API - WebChromeClient.onReceivedIcon](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedIcon(android.webkit.WebView,%20android.graphics.Bitmap)))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, Uint8List icon)? final void Function(T controller, Uint8List icon)?
onReceivedIcon; onReceivedIcon;
///Use [onReceivedTouchIconUrl] instead. ///Use [onReceivedTouchIconUrl] instead.
@Deprecated('Use onReceivedTouchIconUrl instead') @Deprecated('Use onReceivedTouchIconUrl instead')
final void Function( final void Function(
PlatformInAppWebViewController controller, Uri url, bool precomposed)? T controller, Uri url, bool precomposed)?
androidOnReceivedTouchIconUrl; androidOnReceivedTouchIconUrl;
///{@template flutter_inappwebview.WebView.onReceivedTouchIconUrl} ///{@template flutter_inappwebview.WebView.onReceivedTouchIconUrl}
@ -890,13 +892,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean))) ///- Android native WebView ([Official API - WebChromeClient.onReceivedTouchIconUrl](https://developer.android.com/reference/android/webkit/WebChromeClient#onReceivedTouchIconUrl(android.webkit.WebView,%20java.lang.String,%20boolean)))
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, WebUri url, bool precomposed)? T controller, WebUri url, bool precomposed)?
onReceivedTouchIconUrl; onReceivedTouchIconUrl;
///Use [onJsBeforeUnload] instead. ///Use [onJsBeforeUnload] instead.
@Deprecated('Use onJsBeforeUnload instead') @Deprecated('Use onJsBeforeUnload instead')
final Future<JsBeforeUnloadResponse?> Function( final Future<JsBeforeUnloadResponse?> Function(
PlatformInAppWebViewController controller, T controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? androidOnJsBeforeUnload; JsBeforeUnloadRequest jsBeforeUnloadRequest)? androidOnJsBeforeUnload;
///{@template flutter_inappwebview.WebView.onJsBeforeUnload} ///{@template flutter_inappwebview.WebView.onJsBeforeUnload}
@ -914,13 +916,13 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult))) ///- Android native WebView ([Official API - WebChromeClient.onJsBeforeUnload](https://developer.android.com/reference/android/webkit/WebChromeClient#onJsBeforeUnload(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20android.webkit.JsResult)))
///{@endtemplate} ///{@endtemplate}
final Future<JsBeforeUnloadResponse?> Function( final Future<JsBeforeUnloadResponse?> Function(
PlatformInAppWebViewController controller, T controller,
JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload; JsBeforeUnloadRequest jsBeforeUnloadRequest)? onJsBeforeUnload;
///Use [onReceivedLoginRequest] instead. ///Use [onReceivedLoginRequest] instead.
@Deprecated('Use onReceivedLoginRequest instead') @Deprecated('Use onReceivedLoginRequest instead')
final void Function( final void Function(
PlatformInAppWebViewController controller, LoginRequest loginRequest)? T controller, LoginRequest loginRequest)?
androidOnReceivedLoginRequest; androidOnReceivedLoginRequest;
///{@template flutter_inappwebview.WebView.onReceivedLoginRequest} ///{@template flutter_inappwebview.WebView.onReceivedLoginRequest}
@ -932,7 +934,7 @@ class PlatformWebViewCreationParams {
///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String))) ///- Android native WebView ([Official API - WebViewClient.onReceivedLoginRequest](https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedLoginRequest(android.webkit.WebView,%20java.lang.String,%20java.lang.String,%20java.lang.String)))
///{@endtemplate} ///{@endtemplate}
final void Function( final void Function(
PlatformInAppWebViewController controller, LoginRequest loginRequest)? T controller, LoginRequest loginRequest)?
onReceivedLoginRequest; onReceivedLoginRequest;
///{@template flutter_inappwebview.WebView.onPermissionRequestCanceled} ///{@template flutter_inappwebview.WebView.onPermissionRequestCanceled}
@ -947,7 +949,7 @@ class PlatformWebViewCreationParams {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onPermissionRequestCanceled](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequestCanceled(android.webkit.PermissionRequest))) ///- Android native WebView ([Official API - WebChromeClient.onPermissionRequestCanceled](https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequestCanceled(android.webkit.PermissionRequest)))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, final void Function(T controller,
PermissionRequest permissionRequest)? onPermissionRequestCanceled; PermissionRequest permissionRequest)? onPermissionRequestCanceled;
///{@template flutter_inappwebview.WebView.onRequestFocus} ///{@template flutter_inappwebview.WebView.onRequestFocus}
@ -957,11 +959,11 @@ class PlatformWebViewCreationParams {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- Android native WebView ([Official API - WebChromeClient.onRequestFocus](https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView))) ///- Android native WebView ([Official API - WebChromeClient.onRequestFocus](https://developer.android.com/reference/android/webkit/WebChromeClient#onRequestFocus(android.webkit.WebView)))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? onRequestFocus; final void Function(T controller)? onRequestFocus;
///Use [onWebContentProcessDidTerminate] instead. ///Use [onWebContentProcessDidTerminate] instead.
@Deprecated('Use onWebContentProcessDidTerminate instead') @Deprecated('Use onWebContentProcessDidTerminate instead')
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
iosOnWebContentProcessDidTerminate; iosOnWebContentProcessDidTerminate;
///{@template flutter_inappwebview.WebView.onWebContentProcessDidTerminate} ///{@template flutter_inappwebview.WebView.onWebContentProcessDidTerminate}
@ -971,12 +973,12 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) ///- iOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi)) ///- MacOS ([Official API - WKNavigationDelegate.webViewWebContentProcessDidTerminate](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
onWebContentProcessDidTerminate; onWebContentProcessDidTerminate;
///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead. ///Use [onDidReceiveServerRedirectForProvisionalNavigation] instead.
@Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead') @Deprecated('Use onDidReceiveServerRedirectForProvisionalNavigation instead')
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
iosOnDidReceiveServerRedirectForProvisionalNavigation; iosOnDidReceiveServerRedirectForProvisionalNavigation;
///{@template flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation} ///{@template flutter_inappwebview.WebView.onDidReceiveServerRedirectForProvisionalNavigation}
@ -986,13 +988,13 @@ class PlatformWebViewCreationParams {
///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) ///- iOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455627-webview))
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller)? final void Function(T controller)?
onDidReceiveServerRedirectForProvisionalNavigation; onDidReceiveServerRedirectForProvisionalNavigation;
///Use [onNavigationResponse] instead. ///Use [onNavigationResponse] instead.
@Deprecated('Use onNavigationResponse instead') @Deprecated('Use onNavigationResponse instead')
final Future<IOSNavigationResponseAction?> Function( final Future<IOSNavigationResponseAction?> Function(
PlatformInAppWebViewController controller, T controller,
IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse; IOSWKNavigationResponse navigationResponse)? iosOnNavigationResponse;
///{@template flutter_inappwebview.WebView.onNavigationResponse} ///{@template flutter_inappwebview.WebView.onNavigationResponse}
@ -1007,13 +1009,13 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview))
///{@endtemplate} ///{@endtemplate}
final Future<NavigationResponseAction?> Function( final Future<NavigationResponseAction?> Function(
PlatformInAppWebViewController controller, T controller,
NavigationResponse navigationResponse)? onNavigationResponse; NavigationResponse navigationResponse)? onNavigationResponse;
///Use [shouldAllowDeprecatedTLS] instead. ///Use [shouldAllowDeprecatedTLS] instead.
@Deprecated('Use shouldAllowDeprecatedTLS instead') @Deprecated('Use shouldAllowDeprecatedTLS instead')
final Future<IOSShouldAllowDeprecatedTLSAction?> Function( final Future<IOSShouldAllowDeprecatedTLSAction?> Function(
PlatformInAppWebViewController controller, T controller,
URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? iosShouldAllowDeprecatedTLS;
///{@template flutter_inappwebview.WebView.shouldAllowDeprecatedTLS} ///{@template flutter_inappwebview.WebView.shouldAllowDeprecatedTLS}
@ -1030,7 +1032,7 @@ class PlatformWebViewCreationParams {
///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview)) ///- MacOS ([Official API - WKNavigationDelegate.webView](https://developer.apple.com/documentation/webkit/wknavigationdelegate/3601237-webview))
///{@endtemplate} ///{@endtemplate}
final Future<ShouldAllowDeprecatedTLSAction?> Function( final Future<ShouldAllowDeprecatedTLSAction?> Function(
PlatformInAppWebViewController controller, T controller,
URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS; URLAuthenticationChallenge challenge)? shouldAllowDeprecatedTLS;
///{@template flutter_inappwebview.WebView.onCameraCaptureStateChanged} ///{@template flutter_inappwebview.WebView.onCameraCaptureStateChanged}
@ -1045,7 +1047,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<void> Function( final Future<void> Function(
PlatformInAppWebViewController controller, T controller,
MediaCaptureState? oldState, MediaCaptureState? oldState,
MediaCaptureState? newState, MediaCaptureState? newState,
)? onCameraCaptureStateChanged; )? onCameraCaptureStateChanged;
@ -1062,7 +1064,7 @@ class PlatformWebViewCreationParams {
///- MacOS ///- MacOS
///{@endtemplate} ///{@endtemplate}
final Future<void> Function( final Future<void> Function(
PlatformInAppWebViewController controller, T controller,
MediaCaptureState? oldState, MediaCaptureState? oldState,
MediaCaptureState? newState, MediaCaptureState? newState,
)? onMicrophoneCaptureStateChanged; )? onMicrophoneCaptureStateChanged;
@ -1077,7 +1079,7 @@ class PlatformWebViewCreationParams {
///**Supported Platforms/Implementations**: ///**Supported Platforms/Implementations**:
///- iOS ///- iOS
///{@endtemplate} ///{@endtemplate}
final void Function(PlatformInAppWebViewController controller, Size oldContentSize, final void Function(T controller, Size oldContentSize,
Size newContentSize)? onContentSizeChanged; Size newContentSize)? onContentSizeChanged;
///{@template flutter_inappwebview.WebView.initialUrlRequest} ///{@template flutter_inappwebview.WebView.initialUrlRequest}
@ -1178,7 +1180,8 @@ class PlatformWebViewCreationParams {
///{@macro flutter_inappwebview.WebView} ///{@macro flutter_inappwebview.WebView}
const PlatformWebViewCreationParams( const PlatformWebViewCreationParams(
{this.windowId, {this.controllerFromPlatform,
this.windowId,
this.onWebViewCreated, this.onWebViewCreated,
this.onLoadStart, this.onLoadStart,
this.onLoadStop, this.onLoadStop,

View File

@ -1,5 +1,6 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'chrome_safari_browser/platform_chrome_safari_browser.dart';
import 'find_interaction/platform_find_interaction_controller.dart'; import 'find_interaction/platform_find_interaction_controller.dart';
import 'in_app_browser/platform_in_app_browser.dart'; import 'in_app_browser/platform_in_app_browser.dart';
import 'in_app_webview/platform_headless_in_app_webview.dart'; import 'in_app_webview/platform_headless_in_app_webview.dart';
@ -348,26 +349,6 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
'createPlatformTracingController is not implemented on the current platform.'); 'createPlatformTracingController is not implemented on the current platform.');
} }
/// Creates a new [PlatformWebViewAssetLoader].
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
PlatformWebViewAssetLoader createPlatformWebViewAssetLoader(
PlatformWebViewAssetLoaderCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewAssetLoader is not implemented on the current platform.');
}
/// Creates a new empty [PlatformWebViewAssetLoader] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
PlatformWebViewAssetLoader createPlatformWebViewAssetLoaderStatic() {
throw UnimplementedError(
'createPlatformWebViewAssetLoaderStatic is not implemented on the current platform.');
}
/// Creates a new [PlatformPathHandler]. /// Creates a new [PlatformPathHandler].
/// ///
/// This function should only be called by the app-facing package. /// This function should only be called by the app-facing package.
@ -440,4 +421,24 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
PlatformInAppLocalhostServerCreationParams params) { PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServer(params); return DefaultInAppLocalhostServer(params);
} }
/// Creates a new [PlatformChromeSafariBrowser].
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
PlatformChromeSafariBrowser createPlatformChromeSafariBrowser(
PlatformChromeSafariBrowserCreationParams params,
) {
throw UnimplementedError(
'createPlatformChromeSafariBrowser is not implemented on the current platform.');
}
/// Creates a new empty [PlatformChromeSafariBrowser] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [ChromeSafariBrowser] in `flutter_inappwebview` instead.
PlatformChromeSafariBrowser createPlatformChromeSafariBrowserStatic() {
throw UnimplementedError(
'createPlatformChromeSafariBrowserStatic is not implemented on the current platform.');
}
} }

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