diff --git a/CHANGELOG.md b/CHANGELOG.md index 58e8dfb3..7914bbaa 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ - On Android, the `InAppWebView` widget uses hybrid composition by default (`useHybridComposition: true`). +## 5.4.3+4 + +- Updated docs for `ChromeSafariBrowser.open` and throw error on iOS if the `url` parameter use a different scheme then `http` or `https` + ## 5.4.3+3 - Fixed "Android error: package org.jetbrains.annotations does not exist import org.jetbrains.annotations.NotNull;" [#1166](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1166) diff --git a/lib/src/chrome_safari_browser/chrome_safari_browser.dart b/lib/src/chrome_safari_browser/chrome_safari_browser.dart index 5589c292..ffeffdd7 100755 --- a/lib/src/chrome_safari_browser/chrome_safari_browser.dart +++ b/lib/src/chrome_safari_browser/chrome_safari_browser.dart @@ -110,7 +110,7 @@ class ChromeSafariBrowser { ///Opens the [ChromeSafariBrowser] instance with an [url]. /// - ///[url]: The [url] to load. + ///[url]: The [url] to load. On iOS, the [url] must use the `http` or `https` scheme. /// ///[options]: Options for the [ChromeSafariBrowser]. /// @@ -123,6 +123,10 @@ class ChromeSafariBrowser { ChromeSafariBrowserSettings? settings}) async { assert(url.toString().isNotEmpty); this.throwIsAlreadyOpened(message: 'Cannot open $url!'); + if (!kIsWeb && defaultTargetPlatform == TargetPlatform.iOS) { + assert(['http', 'https'].contains(url.scheme), + 'The specified URL has an unsupported scheme. Only HTTP and HTTPS URLs are supported on iOS.'); + } List> menuItemList = []; _menuItems.forEach((key, value) {