updated tests, created InAppLocalHostServer platform interface and default implementation, use where possibile the non-Platform prefix class

This commit is contained in:
Lorenzo Pichilli 2023-11-18 01:17:45 +01:00
parent 1486b5af38
commit d37de77f36
125 changed files with 908 additions and 723 deletions

View File

@ -1,3 +1,9 @@
## 6.1.0-beta.1
### BREAKING CHANGES
Plugin conversion to a [Federated Plugin](https://docs.flutter.dev/packages-and-plugins/developing-packages#federated-plugins) to better support multiple environments and implementations.
## 6.0.0-beta.28
- Added `ProcessGlobalConfig` for Android WebViews

View File

@ -11,8 +11,8 @@ void setGetDelete() {
skippableTestWidgets('set, get, delete', (WidgetTester tester) async {
CookieManager cookieManager = CookieManager.instance();
final Completer<InAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>();
final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>();
var headlessWebView = new HeadlessInAppWebView(
@ -20,12 +20,12 @@ void setGetDelete() {
onWebViewCreated: (controller) {
controllerCompleter.complete(controller);
},
onLoadStop: (controller, url) async {
pageLoaded.complete(url!.toString());
}
);
if (defaultTargetPlatform == TargetPlatform.macOS) {
headlessWebView.onLoadStop = (controller, url) async {
pageLoaded.complete(url!.toString());
};
await headlessWebView.run();
} else {
await tester.pumpWidget(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,8 +10,8 @@ void isLoading() {
].contains(defaultTargetPlatform);
skippableTestWidgets('isLoading', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>();
final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>();
final Completer<void> pageStarted = Completer<void>();
final Completer<void> pageLoaded = Completer<void>();
@ -35,7 +35,7 @@ void isLoading() {
),
);
final InAppWebViewController controller = await controllerCompleter.future;
final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageStarted.future;
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;
skippableTestWidgets('isSecureContext', (WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>();
final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>();
final StreamController<String> pageLoads =
StreamController<String>.broadcast();
@ -33,7 +33,7 @@ void isSecureContext() {
),
);
final InAppWebViewController controller = await controllerCompleter.future;
final PlatformInAppWebViewController controller = await controllerCompleter.future;
await pageLoads.stream.first;
expect(await controller.isSecureContext(), true);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ void apply() {
skippableTestWidgets('apply', (WidgetTester tester) async {
await expectLater(
PlatformProcessGlobalConfig.instance().apply(
ProcessGlobalConfig.instance().apply(
settings: ProcessGlobalConfigSettings(
dataDirectorySuffix:
(await WebViewFeature.isStartupFeatureSupported(

View File

@ -9,15 +9,15 @@ void clearAndSetProxyOverride() {
skippableTestWidgets('clear and set proxy override',
(WidgetTester tester) async {
final Completer<InAppWebViewController> controllerCompleter =
Completer<InAppWebViewController>();
final Completer<PlatformInAppWebViewController> controllerCompleter =
Completer<PlatformInAppWebViewController>();
final Completer<String> pageLoaded = Completer<String>();
var proxyAvailable =
await WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE);
if (proxyAvailable) {
PlatformProxyController proxyController = PlatformProxyController.instance();
ProxyController proxyController = ProxyController.instance();
await proxyController.clearProxyOverride();
await proxyController.setProxyOverride(
@ -42,7 +42,7 @@ void clearAndSetProxyOverride() {
),
);
final InAppWebViewController controller = await controllerCompleter.future;
final PlatformInAppWebViewController controller = await controllerCompleter.future;
final String url = await pageLoaded.future;
expect(url, TEST_URL_HTTP_EXAMPLE.toString());

View File

@ -17,8 +17,8 @@ void setServiceWorkerClient() {
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
if (swAvailable && swInterceptAvailable) {
PlatformServiceWorkerController serviceWorkerController =
PlatformServiceWorkerController.instance();
ServiceWorkerController serviceWorkerController =
ServiceWorkerController.instance();
await serviceWorkerController.setServiceWorkerClient(null);
}

View File

@ -16,8 +16,8 @@ void shouldInterceptRequest() {
WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
if (swAvailable && swInterceptAvailable) {
PlatformServiceWorkerController serviceWorkerController =
PlatformServiceWorkerController.instance();
ServiceWorkerController serviceWorkerController =
ServiceWorkerController.instance();
await serviceWorkerController.setServiceWorkerClient(ServiceWorkerClient(
shouldInterceptRequest: (request) async {

View File

@ -18,8 +18,8 @@ import 'tracing_controller/main.dart' as tracing_controller_tests;
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
WebView.debugLoggingSettings.usePrint = true;
WebView.debugLoggingSettings.maxLogMessageLength = 7000;
PlatformInAppWebViewController.debugLoggingSettings.usePrint = true;
PlatformInAppWebViewController.debugLoggingSettings.maxLogMessageLength = 7000;
InAppBrowser.debugLoggingSettings.usePrint = true;
InAppBrowser.debugLoggingSettings.maxLogMessageLength = 7000;
PlatformChromeSafariBrowser.debugLoggingSettings.usePrint = true;

View File

@ -7,7 +7,7 @@ import 'main.dart';
class HeadlessInAppWebViewExampleScreen extends StatefulWidget {
@override
_HeadlessInAppWebViewExampleScreenState createState() =>
new _HeadlessInAppWebViewExampleScreenState();
_HeadlessInAppWebViewExampleScreenState();
}
class _HeadlessInAppWebViewExampleScreenState
@ -23,7 +23,7 @@ class _HeadlessInAppWebViewExampleScreenState
? WebUri("https://flutter.dev")
: WebUri("http://localhost:${Uri.base.port}/page.html");
headlessWebView = new HeadlessInAppWebView(
headlessWebView = HeadlessInAppWebView(
initialUrlRequest: URLRequest(url: url),
initialSettings: InAppWebViewSettings(
isInspectable: kDebugMode,
@ -88,8 +88,9 @@ class _HeadlessInAppWebViewExampleScreenState
child: ElevatedButton(
onPressed: () async {
if (headlessWebView?.isRunning() ?? false) {
await headlessWebView?.webViewController?.evaluateJavascript(
source: """console.log('Here is the message!');""");
await headlessWebView?.webViewController
?.evaluateJavascript(
source: """console.log('Here is the message!');""");
} else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(

View File

@ -66,7 +66,7 @@ class MyInAppBrowser extends InAppBrowser {
class InAppBrowserExampleScreen extends StatefulWidget {
@override
_InAppBrowserExampleScreenState createState() =>
new _InAppBrowserExampleScreenState();
_InAppBrowserExampleScreenState();
}
class _InAppBrowserExampleScreenState extends State<InAppBrowserExampleScreen> {

View File

@ -9,7 +9,7 @@ import 'main.dart';
class InAppWebViewExampleScreen extends StatefulWidget {
@override
_InAppWebViewExampleScreenState createState() =>
new _InAppWebViewExampleScreenState();
_InAppWebViewExampleScreenState();
}
class _InAppWebViewExampleScreenState extends State<InAppWebViewExampleScreen> {

View File

@ -15,7 +15,7 @@ import 'package:pointer_interceptor/pointer_interceptor.dart';
// import 'package:permission_handler/permission_handler.dart';
InAppLocalhostServer localhostServer =
new InAppLocalhostServer(documentRoot: 'assets');
InAppLocalhostServer(documentRoot: 'assets');
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -130,7 +130,7 @@ PointerInterceptor myDrawer({required BuildContext context}) {
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {

View File

@ -12,7 +12,7 @@ class WebAuthenticationSessionExampleScreen extends StatefulWidget {
class _WebAuthenticationSessionExampleScreenState
extends State<WebAuthenticationSessionExampleScreen> {
PlatformWebAuthenticationSession? session;
WebAuthenticationSession? session;
String? token;
@override

View File

@ -1,25 +0,0 @@
// This is a basic Flutter integration test.
//
// Since integration tests run in a full Flutter application, they can interact
// with the host side of a plugin implementation, unlike Dart unit tests.
//
// For more information about Flutter integration tests, please see
// https://docs.flutter.dev/cookbook/testing/integration/introduction
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('getPlatformVersion test', (WidgetTester tester) async {
final FlutterInappwebviewAndroid plugin = FlutterInappwebviewAndroid();
final String? version = await plugin.getPlatformVersion();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
expect(version?.isNotEmpty, true);
});
}

View File

@ -1,63 +0,0 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
final _flutterInappwebviewAndroidPlugin = FlutterInappwebviewAndroid();
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _flutterInappwebviewAndroidPlugin.getPlatformVersion() ?? 'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on: $_platformVersion\n'),
),
),
);
}
}

View File

@ -1,27 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data!.startsWith('Running on:'),
),
findsOneWidget,
);
});
}

View File

@ -322,9 +322,7 @@ class AndroidInAppWebViewWidget extends PlatformInAppWebViewWidget {
return PlatformViewLink(
// Setting a default key using `params` ensures the `PlatformViewLink`
// recreates the PlatformView when changes are made.
key: _androidParams.key ??
ValueKey<AndroidInAppWebViewWidgetCreationParams>(
params as AndroidInAppWebViewWidgetCreationParams),
key: _androidParams.key,
viewType: 'com.pichillilorenzo/flutter_inappwebview',
surfaceFactory: (
BuildContext context,

View File

@ -1,27 +0,0 @@
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_method_channel.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
MethodChannelInAppWebViewFlutterAndroid platform = MethodChannelInAppWebViewFlutterAndroid();
const MethodChannel channel = MethodChannel('flutter_inappwebview_android');
setUp(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(
channel,
(MethodCall methodCall) async {
return '42';
},
);
});
tearDown(() {
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
});
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
});
}

View File

@ -1,29 +0,0 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_platform_interface.dart';
import 'package:flutter_inappwebview_android/flutter_inappwebview_android_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockFlutterInappwebviewAndroidPlatform
with MockPlatformInterfaceMixin
implements InAppWebViewFlutterAndroid {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final InAppWebViewFlutterAndroid initialPlatform = InAppWebViewFlutterAndroid.instance;
test('$MethodChannelInAppWebViewFlutterAndroid is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelInAppWebViewFlutterAndroid>());
});
test('getPlatformVersion', () async {
FlutterInappwebviewAndroid flutterInappwebviewAndroidPlugin = FlutterInappwebviewAndroid();
MockFlutterInappwebviewAndroidPlatform fakePlatform = MockFlutterInappwebviewAndroidPlatform();
InAppWebViewFlutterAndroid.instance = fakePlatform;
expect(await flutterInappwebviewAndroidPlugin.getPlatformVersion(), '42');
});
}

View File

@ -2,9 +2,33 @@ import 'dart:io';
import 'dart:async';
import 'dart:typed_data';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'mime_type_resolver.dart';
import 'platform_in_app_localhost_server.dart';
/// Object specifying creation parameters for creating a [DefaultInAppLocalhostServer].
///
/// When adding additional fields make sure they can be null or have a default
/// value to avoid breaking changes. See [PlatformInAppLocalhostServerCreationParams] for
/// more information.
@immutable
class DefaultInAppLocalhostServerCreationParams
extends PlatformInAppLocalhostServerCreationParams {
/// Creates a new [DefaultInAppLocalhostServerCreationParams] instance.
const DefaultInAppLocalhostServerCreationParams(
// This parameter prevents breaking changes later.
// ignore: avoid_unused_constructor_parameters
PlatformInAppLocalhostServerCreationParams params,
) : super();
/// Creates a [DefaultInAppLocalhostServerCreationParams] instance based on [PlatformInAppLocalhostServerCreationParams].
factory DefaultInAppLocalhostServerCreationParams.fromPlatformInAppLocalhostServerCreationParams(
PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServerCreationParams(params);
}
}
///This class allows you to create a simple server on `http://localhost:[port]/`
///in order to be able to load your assets file on a local server.
@ -14,7 +38,7 @@ import 'mime_type_resolver.dart';
///- Android native WebView
///- iOS
///- MacOS
class InAppLocalhostServer {
class DefaultInAppLocalhostServer extends PlatformInAppLocalhostServer {
bool _started = false;
HttpServer? _server;
int _port = 8080;
@ -22,24 +46,14 @@ class InAppLocalhostServer {
String _directoryIndex = 'index.html';
String _documentRoot = './';
///- [port] represents the port of the server. The default value is `8080`.
///
///- [directoryIndex] represents the index file to use. The default value is `index.html`.
///
///- [documentRoot] represents the document root path to serve. The default value is `./`.
///
///- The optional argument [shared] specifies whether additional `HttpServer`
/// objects can bind to the same combination of `address`, `port` and `v6Only`.
/// If `shared` is `true` and more `HttpServer`s from this isolate or other
/// isolates are bound to the port, then the incoming connections will be
/// distributed among all the bound `HttpServer`s. Connections can be
/// distributed over multiple isolates this way.
InAppLocalhostServer({
int port = 8080,
String directoryIndex = 'index.html',
String documentRoot = './',
bool shared = false,
}) {
/// Creates a new [DefaultInAppLocalhostServer].
DefaultInAppLocalhostServer(PlatformInAppLocalhostServerCreationParams params)
: super.implementation(
params is DefaultInAppLocalhostServerCreationParams
? params
: DefaultInAppLocalhostServerCreationParams
.fromPlatformInAppLocalhostServerCreationParams(params),
) {
this._port = port;
this._directoryIndex = directoryIndex;
this._documentRoot =
@ -47,6 +61,18 @@ class InAppLocalhostServer {
this._shared = shared;
}
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
int get port => _port;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
String get directoryIndex => _directoryIndex;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
String get documentRoot => _documentRoot;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
bool get shared => _shared;
///Starts the server on `http://localhost:[port]/`.
///
///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file

View File

@ -48,6 +48,16 @@ List<ContentBlocker> _deserializeContentBlockers(
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.
@ExchangeableObject(copyMethod: true)
class InAppWebViewSettings_ {
@ -371,6 +381,9 @@ 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.
///Loading local files using web-like URLs instead of `file://` is desirable as it is compatible with the Same-Origin policy.
@SupportedPlatforms(platforms: [AndroidPlatform()])
@ExchangeableObjectProperty(
serializer: _serializeWebViewAssetLoader,
deserializer: _deserializeWebViewAssetLoader)
PlatformWebViewAssetLoader? webViewAssetLoader;
///Sets the text zoom of the page in percent. The default value is `100`.

View File

@ -1404,7 +1404,8 @@ class InAppWebViewSettings {
? UtilColor.fromStringRepresentation(
map['verticalScrollbarTrackColor'])
: null,
webViewAssetLoader: map['webViewAssetLoader'],
webViewAssetLoader:
_deserializeWebViewAssetLoader(map['webViewAssetLoader']),
);
instance.accessibilityIgnoresInvertColors =
map['accessibilityIgnoresInvertColors'];
@ -1686,7 +1687,7 @@ class InAppWebViewSettings {
"verticalScrollbarPosition": verticalScrollbarPosition?.toNativeValue(),
"verticalScrollbarThumbColor": verticalScrollbarThumbColor?.toHex(),
"verticalScrollbarTrackColor": verticalScrollbarTrackColor?.toHex(),
"webViewAssetLoader": webViewAssetLoader,
"webViewAssetLoader": _serializeWebViewAssetLoader(webViewAssetLoader),
};
}

View File

@ -7,6 +7,7 @@ import 'in_app_webview/platform_inappwebview_controller.dart';
import 'in_app_webview/platform_inappwebview_widget.dart';
import 'platform_cookie_manager.dart';
import 'platform_http_auth_credentials_database.dart';
import 'platform_in_app_localhost_server.dart';
import 'print_job/platform_print_job_controller.dart';
import 'pull_to_refresh/platform_pull_to_refresh_controller.dart';
import 'web_authentication_session/platform_web_authenticate_session.dart';
@ -21,6 +22,7 @@ import 'platform_service_worker_controller.dart';
import 'platform_tracing_controller.dart';
import 'platform_webview_asset_loader.dart';
import 'platform_webview_feature.dart';
import 'in_app_localhost_server.dart';
/// Interface for a platform implementation of a WebView.
abstract class InAppWebViewPlatform extends PlatformInterface {
@ -51,8 +53,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [CookieManager] in `flutter_inappwebview` instead.
PlatformCookieManager createPlatformCookieManager(
PlatformCookieManagerCreationParams params,
) {
PlatformCookieManagerCreationParams params,
) {
throw UnimplementedError(
'createPlatformCookieManager is not implemented on the current platform.');
}
@ -62,8 +64,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [InAppWebViewController] in `flutter_inappwebview` instead.
PlatformInAppWebViewController createPlatformInAppWebViewController(
PlatformInAppWebViewControllerCreationParams params,
) {
PlatformInAppWebViewControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppWebViewController is not implemented on the current platform.');
}
@ -82,8 +84,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [InAppWebView] in `flutter_inappwebview` instead.
PlatformInAppWebViewWidget createPlatformInAppWebViewWidget(
PlatformInAppWebViewWidgetCreationParams params,
) {
PlatformInAppWebViewWidgetCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppWebViewWidget is not implemented on the current platform.');
}
@ -93,8 +95,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [FindInteractionController] in `flutter_inappwebview` instead.
PlatformFindInteractionController createPlatformFindInteractionController(
PlatformFindInteractionControllerCreationParams params,
) {
PlatformFindInteractionControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformFindInteractionController is not implemented on the current platform.');
}
@ -104,8 +106,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [PrintJobController] in `flutter_inappwebview` instead.
PlatformPrintJobController createPlatformPrintJobController(
PlatformPrintJobControllerCreationParams params,
) {
PlatformPrintJobControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformPrintJobController is not implemented on the current platform.');
}
@ -115,8 +117,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [PullToRefreshController] in `flutter_inappwebview` instead.
PlatformPullToRefreshController createPlatformPullToRefreshController(
PlatformPullToRefreshControllerCreationParams params,
) {
PlatformPullToRefreshControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformPullToRefreshController is not implemented on the current platform.');
}
@ -126,8 +128,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead.
PlatformWebAuthenticationSession createPlatformWebAuthenticationSession(
PlatformWebAuthenticationSessionCreationParams params,
) {
PlatformWebAuthenticationSessionCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebAuthenticationSession is not implemented on the current platform.');
}
@ -136,7 +138,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
///
/// This function should only be called by the app-facing package.
/// Look at using [WebAuthenticationSession] in `flutter_inappwebview` instead.
PlatformWebAuthenticationSession createPlatformWebAuthenticationSessionStatic() {
PlatformWebAuthenticationSession
createPlatformWebAuthenticationSessionStatic() {
throw UnimplementedError(
'createPlatformWebAuthenticationSessionStatic is not implemented on the current platform.');
}
@ -146,8 +149,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebMessageChannel] in `flutter_inappwebview` instead.
PlatformWebMessageChannel createPlatformWebMessageChannel(
PlatformWebMessageChannelCreationParams params,
) {
PlatformWebMessageChannelCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessageChannel is not implemented on the current platform.');
}
@ -166,8 +169,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebMessageListener] in `flutter_inappwebview` instead.
PlatformWebMessageListener createPlatformWebMessageListener(
PlatformWebMessageListenerCreationParams params,
) {
PlatformWebMessageListenerCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessageListener is not implemented on the current platform.');
}
@ -177,8 +180,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [JavaScriptReplyProxy] in `flutter_inappwebview` instead.
PlatformJavaScriptReplyProxy createPlatformJavaScriptReplyProxy(
PlatformJavaScriptReplyProxyCreationParams params,
) {
PlatformJavaScriptReplyProxyCreationParams params,
) {
throw UnimplementedError(
'createPlatformJavaScriptReplyProxy is not implemented on the current platform.');
}
@ -188,8 +191,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebMessagePort] in `flutter_inappwebview` instead.
PlatformWebMessagePort createPlatformWebMessagePort(
PlatformWebMessagePortCreationParams params,
) {
PlatformWebMessagePortCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebMessagePort is not implemented on the current platform.');
}
@ -199,8 +202,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebStorage] in `flutter_inappwebview` instead.
PlatformWebStorage createPlatformWebStorage(
PlatformWebStorageCreationParams params,
) {
PlatformWebStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebStorage is not implemented on the current platform.');
}
@ -210,8 +213,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [Storage] in `flutter_inappwebview` instead.
PlatformStorage createPlatformStorage(
PlatformStorageCreationParams params,
) {
PlatformStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformStorage is not implemented on the current platform.');
}
@ -221,8 +224,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [LocalStorage] in `flutter_inappwebview` instead.
PlatformLocalStorage createPlatformLocalStorage(
PlatformLocalStorageCreationParams params,
) {
PlatformLocalStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformLocalStorage is not implemented on the current platform.');
}
@ -232,8 +235,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [PlatformSessionStorage] in `flutter_inappwebview` instead.
PlatformSessionStorage createPlatformSessionStorage(
PlatformSessionStorageCreationParams params,
) {
PlatformSessionStorageCreationParams params,
) {
throw UnimplementedError(
'createPlatformSessionStorage is not implemented on the current platform.');
}
@ -243,8 +246,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [HeadlessInAppWebView] in `flutter_inappwebview` instead.
PlatformHeadlessInAppWebView createPlatformHeadlessInAppWebView(
PlatformHeadlessInAppWebViewCreationParams params,
) {
PlatformHeadlessInAppWebViewCreationParams params,
) {
throw UnimplementedError(
'createPlatformHeadlessInAppWebView is not implemented on the current platform.');
}
@ -254,8 +257,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [CookieManager] in `flutter_inappwebview` instead.
PlatformWebStorageManager createPlatformWebStorageManager(
PlatformWebStorageManagerCreationParams params,
) {
PlatformWebStorageManagerCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebStorageManager is not implemented on the current platform.');
}
@ -265,8 +268,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [HttpAuthCredentialDatabase] in `flutter_inappwebview` instead.
PlatformHttpAuthCredentialDatabase createPlatformHttpAuthCredentialDatabase(
PlatformHttpAuthCredentialDatabaseCreationParams params,
) {
PlatformHttpAuthCredentialDatabaseCreationParams params,
) {
throw UnimplementedError(
'createPlatformHttpAuthCredentialDatabase is not implemented on the current platform.');
}
@ -276,8 +279,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [InAppBrowser] in `flutter_inappwebview` instead.
PlatformInAppBrowser createPlatformInAppBrowser(
PlatformInAppBrowserCreationParams params,
) {
PlatformInAppBrowserCreationParams params,
) {
throw UnimplementedError(
'createPlatformInAppBrowser is not implemented on the current platform.');
}
@ -296,8 +299,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [ProcessGlobalConfig] in `flutter_inappwebview` instead.
PlatformProcessGlobalConfig createPlatformProcessGlobalConfig(
PlatformProcessGlobalConfigCreationParams params,
) {
PlatformProcessGlobalConfigCreationParams params,
) {
throw UnimplementedError(
'createPlatformProcessGlobalConfig is not implemented on the current platform.');
}
@ -307,8 +310,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [ProxyController] in `flutter_inappwebview` instead.
PlatformProxyController createPlatformProxyController(
PlatformProxyControllerCreationParams params,
) {
PlatformProxyControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformProxyController is not implemented on the current platform.');
}
@ -318,8 +321,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
PlatformServiceWorkerController createPlatformServiceWorkerController(
PlatformServiceWorkerControllerCreationParams params,
) {
PlatformServiceWorkerControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformServiceWorkerController is not implemented on the current platform.');
}
@ -328,7 +331,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
///
/// This function should only be called by the app-facing package.
/// Look at using [ServiceWorkerController] in `flutter_inappwebview` instead.
PlatformServiceWorkerController createPlatformServiceWorkerControllerStatic() {
PlatformServiceWorkerController
createPlatformServiceWorkerControllerStatic() {
throw UnimplementedError(
'createPlatformServiceWorkerControllerStatic is not implemented on the current platform.');
}
@ -338,8 +342,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [TracingController] in `flutter_inappwebview` instead.
PlatformTracingController createPlatformTracingController(
PlatformTracingControllerCreationParams params,
) {
PlatformTracingControllerCreationParams params,
) {
throw UnimplementedError(
'createPlatformTracingController is not implemented on the current platform.');
}
@ -349,8 +353,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebViewAssetLoader] in `flutter_inappwebview` instead.
PlatformWebViewAssetLoader createPlatformWebViewAssetLoader(
PlatformWebViewAssetLoaderCreationParams params,
) {
PlatformWebViewAssetLoaderCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewAssetLoader is not implemented on the current platform.');
}
@ -369,8 +373,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [PathHandler] in `flutter_inappwebview` instead.
PlatformPathHandler createPlatformPathHandler(
PlatformPathHandlerCreationParams params,
) {
PlatformPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformPathHandler is not implemented on the current platform.');
}
@ -380,8 +384,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [AssetsPathHandler] in `flutter_inappwebview` instead.
PlatformAssetsPathHandler createPlatformAssetsPathHandler(
PlatformAssetsPathHandlerCreationParams params,
) {
PlatformAssetsPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformAssetsPathHandler is not implemented on the current platform.');
}
@ -391,8 +395,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [ResourcesPathHandler] in `flutter_inappwebview` instead.
PlatformResourcesPathHandler createPlatformResourcesPathHandler(
PlatformResourcesPathHandlerCreationParams params,
) {
PlatformResourcesPathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformResourcesPathHandler is not implemented on the current platform.');
}
@ -402,8 +406,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [InternalStoragePathHandler] in `flutter_inappwebview` instead.
PlatformInternalStoragePathHandler createPlatformInternalStoragePathHandler(
PlatformInternalStoragePathHandlerCreationParams params,
) {
PlatformInternalStoragePathHandlerCreationParams params,
) {
throw UnimplementedError(
'createPlatformInternalStoragePathHandler is not implemented on the current platform.');
}
@ -413,8 +417,8 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
/// This function should only be called by the app-facing package.
/// Look at using [WebViewFeature] in `flutter_inappwebview` instead.
PlatformWebViewFeature createPlatformWebViewFeature(
PlatformWebViewFeatureCreationParams params,
) {
PlatformWebViewFeatureCreationParams params,
) {
throw UnimplementedError(
'createPlatformWebViewFeature is not implemented on the current platform.');
}
@ -427,4 +431,13 @@ abstract class InAppWebViewPlatform extends PlatformInterface {
throw UnimplementedError(
'createPlatformWebViewFeatureStatic is not implemented on the current platform.');
}
/// Creates a new empty [PlatformInAppLocalhostServer] to access static methods.
///
/// This function should only be called by the app-facing package.
/// Look at using [DefaultInAppLocalhostServer] in `flutter_inappwebview` instead.
PlatformInAppLocalhostServer createPlatformInAppLocalhostServer(
PlatformInAppLocalhostServerCreationParams params) {
return DefaultInAppLocalhostServer(params);
}
}

View File

@ -6,7 +6,6 @@ export 'chrome_safari_browser/main.dart';
export 'x509_certificate/main.dart';
export 'web_storage/main.dart';
export 'platform_cookie_manager.dart';
export 'in_app_localhost_server.dart';
export 'content_blocker.dart';
export 'platform_http_auth_credentials_database.dart';
export 'context_menu/main.dart';
@ -22,13 +21,9 @@ export 'platform_service_worker_controller.dart';
export 'platform_webview_feature.dart'
hide WebViewFeature_, AndroidWebViewFeature_;
export 'platform_proxy_controller.dart' hide ProxySettings_;
export 'platform_webview_asset_loader.dart'
hide
PlatformWebViewAssetLoader_,
PlatformPathHandler_,
PlatformAssetsPathHandler_,
PlatformResourcesPathHandler_,
PlatformInternalStoragePathHandler_;
export 'platform_webview_asset_loader.dart';
export 'platform_tracing_controller.dart' hide TracingSettings_;
export 'platform_process_global_config.dart'
hide ProcessGlobalConfigSettings_, ProcessGlobalConfigDirectoryBasePaths_;
export 'platform_in_app_localhost_server.dart';
export 'in_app_localhost_server.dart';

View File

@ -0,0 +1,125 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
/// Object specifying creation parameters for creating a [PlatformInAppLocalhostServer].
///
/// Platform specific implementations can add additional fields by extending
/// this class.
@immutable
class PlatformInAppLocalhostServerCreationParams {
/// Used by the platform implementation to create a new [PlatformInAppLocalhostServer].
const PlatformInAppLocalhostServerCreationParams({
this.port = 8080,
this.directoryIndex = 'index.html',
this.documentRoot = './',
this.shared = false,
});
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
final int port;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
final String directoryIndex;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
final String documentRoot;
///{@macro flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
final bool shared;
}
///This class allows you to create a simple server on `http://localhost:[port]/`
///in order to be able to load your assets file on a local server.
///The default `port` value is `8080`.
///
///**Supported Platforms/Implementations**:
///- Android native WebView
///- iOS
///- MacOS
abstract class PlatformInAppLocalhostServer extends PlatformInterface {
/// Creates a new [PlatformInAppLocalhostServer]
factory PlatformInAppLocalhostServer(PlatformInAppLocalhostServerCreationParams params) {
assert(
InAppWebViewPlatform.instance != null,
'A platform implementation for `flutter_inappwebview` has not been set. Please '
'ensure that an implementation of `InAppWebViewPlatform` has been set to '
'`WebViewPlatform.instance` before use. For unit testing, '
'`WebViewPlatform.instance` can be set with your own test implementation.',
);
final PlatformInAppLocalhostServer inAppLocalhostServer =
InAppWebViewPlatform.instance!.createPlatformInAppLocalhostServer(params);
PlatformInterface.verify(inAppLocalhostServer, _token);
return inAppLocalhostServer;
}
/// Used by the platform implementation to create a new
/// [PlatformInAppLocalhostServer].
///
/// Should only be used by platform implementations because they can't extend
/// a class that only contains a factory constructor.
@protected
PlatformInAppLocalhostServer.implementation(this.params)
: super(token: _token);
static final Object _token = Object();
/// The parameters used to initialize the [PlatformInAppLocalhostServer].
final PlatformInAppLocalhostServerCreationParams params;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.port}
///Represents the port of the server. The default value is `8080`.
///{@endtemplate}
int get port => params.port;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.directoryIndex}
///represents the index file to use. The default value is `index.html`.
///{@endtemplate}
String get directoryIndex => params.directoryIndex;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.documentRoot}
///Represents the document root path to serve. The default value is `./`.
///{@endtemplate}
String get documentRoot => params.documentRoot;
///{@template flutter_inappwebview_platform_interface.PlatformInAppLocalhostServer.shared}
///Specifies whether additional `HttpServer`
/// objects can bind to the same combination of `address`, `port` and `v6Only`.
/// If `shared` is `true` and more `HttpServer`s from this isolate or other
/// isolates are bound to the port, then the incoming connections will be
/// distributed among all the bound `HttpServer`s. Connections can be
/// distributed over multiple isolates this way.
///{@endtemplate}
bool get shared => params.shared;
///Starts the server on `http://localhost:[port]/`.
///
///**NOTE for iOS**: For the iOS Platform, you need to add the `NSAllowsLocalNetworking` key with `true` in the `Info.plist` file
///(See [ATS Configuration Basics](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW35)):
///```xml
///<key>NSAppTransportSecurity</key>
///<dict>
/// <key>NSAllowsLocalNetworking</key>
/// <true/>
///</dict>
///```
///The `NSAllowsLocalNetworking` key is available since **iOS 10**.
Future<void> start() {
throw UnimplementedError(
'start is not implemented on the current platform');
}
///Closes the server.
Future<void> close() {
throw UnimplementedError(
'close is not implemented on the current platform');
}
///Indicates if the server is running or not.
bool isRunning() {
throw UnimplementedError(
'isRunning is not implemented on the current platform');
}
}

View File

@ -104,7 +104,7 @@ abstract class PlatformWebViewAssetLoader extends PlatformInterface {
/// The parameters used to initialize the [PlatformWebViewAssetLoader].
final PlatformWebViewAssetLoaderCreationParams params;
PlatformWebViewAssetLoader? fromMap(Map<String, dynamic> map) {
PlatformWebViewAssetLoader? fromMap(Map<String, dynamic>? map) {
throw UnimplementedError(
'fromMap is not implemented on the current platform');
}

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