Upgrading flutter_inappwebview 5 to 6
Breaking5.8.0 → 6.1.5Breaking33Platform5Deprecated5New67Changed38Fixed63Other8
BreakingUpgrade verdict
32 breaking changes and 5 platform requirement changes.
In plain terms
- On Android, console logging now uses the platform's built-in mechanism instead of a bundled script file.
- An Android WebView feature that was not supported has been removed.
- The in-app browser now opens in a separate window by default instead of the previous default.
- By default only async AJAX requests are intercepted now; set the option to false to also intercept sync requests.
Must act Top 5 of 41 that need code or config changes
Dart SDK requirement changed in 6.1.0: >=2.14.0 <3.0.0 → ^3.5.0.
Flutter requirement changed in 6.1.0: >=3.0.0 → >=3.24.0.
What you must change
Breaking32
Removes the ConsoleLogJS.java plugin script file in favor of native WebChromeClient.onConsoleMessage.
ConsoleLogJS.javaWebChromeClient.onConsoleMessageRemoves unsupported WebViewFeature.SUPPRESS_ERROR_PAGE.
WebViewFeature.SUPPRESS_ERROR_PAGEChanges the default value of
InAppBrowserSettings.windowType to WindowType.WINDOW.InAppBrowserSettings.windowTypeWindowType.WINDOWDefaults InAppWebViewSettings.interceptOnlyAsyncAjaxRequests to true, so sync AJAX requests are no longer intercepted by default.
useShouldInterceptAjaxRequestXMLHttpRequest.send()InAppWebViewSettings.interceptOnlyAsyncAjaxRequestsRemoves throwIfAlreadyOpened and throwIfNotOpened InAppBrowser methods.
InAppBrowser.throwIfAlreadyOpened()InAppBrowser.throwIfNotOpened()Removes throwIfAlreadyOpened and throwIfNotOpened ChromeSafariBrowser methods.
ChromeSafariBrowser.throwIfAlreadyOpened()ChromeSafariBrowser.throwIfNotOpened()Removes WebViewFeature.REQUESTED_WITH_HEADER_CONTROL, ServiceWorkerController requested-with-header methods, and InAppWebViewSettings.requestedWithHeaderMode.
WebViewFeature.REQUESTED_WITH_HEADER_CONTROLServiceWorkerController.setRequestedWithHeaderMode()ServiceWorkerController.getRequestedWithHeaderMode()InAppWebViewSettings.requestedWithHeaderModeRemoves the Android WebView setting willSuppressErrorPage in favor of disableDefaultErrorPage.
willSuppressErrorPagedisableDefaultErrorPageRemoves PrintJobInfo.printerId.
PrintJobInfo.printerIdOn Android, the InAppWebView widget now uses hybrid composition by default (useHybridComposition: true).
InAppWebViewuseHybridCompositionRemoves the URLProtectionSpace.iosIsProxy property.
URLProtectionSpace.iosIsProxyConverts the plugin to a Federated Plugin to better support multiple environments and implementations.
Changes the Android package name to com.pichillilorenzo.flutter_inappwebview_android.
com.pichillilorenzo.flutter_inappwebview_androidcom.pichillilorenzo.flutter_inappwebviewcom.pichillilorenzo.flutter_inappwebview_android.InAppWebViewFileProviderChanges the Web Platform web_support.js file path to packages/flutter_inappwebview_web/assets/web/web_support.js.
web_support.jsChanges WebMessage.data to type dynamic.
WebMessage.dataChanges JavaScriptReplyProxy.postMessage to take a WebMessage.
JavaScriptReplyProxy.postMessageWebMessageChanges the signatures of WebMessageListener.onPostMessage and WebMessagePort.setWebMessageCallback.
WebMessageListener.onPostMessageWebMessagePort.setWebMessageCallbackThrows an error if any controller is used after being disposed.
CookieManager.setCookie now returns Future<bool> indicating whether the cookie was set successfully.
CookieManager.setCookieHeadlessInAppWebView.webViewController can now be null.
HeadlessInAppWebView.webViewControllerMakes all PrintJobSettings properties optional.
PrintJobSettingsMakes all PullToRefreshSettings properties optional.
PullToRefreshSettingsMakes all WebAuthenticationSessionSettings properties optional.
WebAuthenticationSessionSettingsReplaces the
Uri type with the new WebUri class across the API.WebUriUriChromeSafariBrowser.onCompletedInitialLoad now passes an optional argument, changing the event callback signature.
ChromeSafariBrowser.onCompletedInitialLoadChromeSafariBrowserMenuItem.action and ChromeSafariBrowserActionButton.action can now be null.
ChromeSafariBrowserMenuItem.actionChromeSafariBrowserActionButton.actionAll ChromeSafariBrowserSettings properties are now optional.
ChromeSafariBrowserSettingsWebResourceResponse.contentType and WebResourceResponse.contentEncoding can now be null.
WebResourceResponse.contentTypeWebResourceResponse.contentEncodingMakes all InAppWebViewSettings and InAppBrowserSettings properties optional.
InAppWebViewSettingsInAppBrowserSettingsMakes InAppBrowser.webViewController nullable.
InAppBrowser.webViewControllerAll properties of GeolocationPermissionShowPromptResponse are now non-nullable.
GeolocationPermissionShowPromptResponsehistoryUrl and baseUrl of InAppWebViewInitialData can now be null.
InAppWebViewInitialDatahistoryUrlbaseUrlPlatform5
Raises the minimum supported SDK to Flutter 3.24 and Dart 3.5.
Raises the minimum Dart SDK version to >= 2.17.0.
Raises the minimum Flutter version to 3.0.0.
Updates Android minSdkVersion to 19.
minSdkVersionUpdates minimum iOS version to 9.0.
Deprecations to plan for
Deprecated4
Deprecates InAppWebViewController.clearCache and InAppWebViewSettings.clearCache in favor of clearAllCache.
InAppWebViewController.clearCacheInAppWebViewSettings.clearCacheInAppWebViewController.clearAllCacheDeprecates InAppWebViewSettings.clearSessionCache in favor of CookieManager.removeSessionCookies.
InAppWebViewSettings.clearSessionCacheCookieManager.removeSessionCookiesDeprecates old classes, properties and methods to make them eventually compatible with other platforms and WebView engines.
Deprecates onLoadError in favor of onReceivedError, which is also called for subframes.
onLoadErroronReceivedErroronLoadHttpErroronReceivedHttpError