Skip to content

Upgrading flutter_inappwebview 5 to 6

Breaking5.8.0 → 6.1.5Breaking33Platform5Deprecated5New67Changed38Fixed63Other8

BreakingUpgrade verdict

32 breaking changes and 5 platform requirement changes.

  • 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.
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.

Breaking32
Removes the ConsoleLogJS.java plugin script file in favor of native WebChromeClient.onConsoleMessage.
ConsoleLogJS.javaWebChromeClient.onConsoleMessage
Removes unsupported WebViewFeature.SUPPRESS_ERROR_PAGE.
WebViewFeature.SUPPRESS_ERROR_PAGE
Changes the default value of InAppBrowserSettings.windowType to WindowType.WINDOW.
InAppBrowserSettings.windowTypeWindowType.WINDOW
Defaults InAppWebViewSettings.interceptOnlyAsyncAjaxRequests to true, so sync AJAX requests are no longer intercepted by default.
useShouldInterceptAjaxRequestXMLHttpRequest.send()InAppWebViewSettings.interceptOnlyAsyncAjaxRequests
Removes 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.requestedWithHeaderMode
Removes the Android WebView setting willSuppressErrorPage in favor of disableDefaultErrorPage.
willSuppressErrorPagedisableDefaultErrorPage
Removes PrintJobInfo.printerId.
PrintJobInfo.printerId
On Android, the InAppWebView widget now uses hybrid composition by default (useHybridComposition: true).
InAppWebViewuseHybridComposition
Removes the URLProtectionSpace.iosIsProxy property.
URLProtectionSpace.iosIsProxy
Converts 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.InAppWebViewFileProvider
Changes the Web Platform web_support.js file path to packages/flutter_inappwebview_web/assets/web/web_support.js.
web_support.js
Changes WebMessage.data to type dynamic.
WebMessage.data
Changes JavaScriptReplyProxy.postMessage to take a WebMessage.
JavaScriptReplyProxy.postMessageWebMessage
Changes the signatures of WebMessageListener.onPostMessage and WebMessagePort.setWebMessageCallback.
WebMessageListener.onPostMessageWebMessagePort.setWebMessageCallback
Throws an error if any controller is used after being disposed.
CookieManager.setCookie now returns Future<bool> indicating whether the cookie was set successfully.
CookieManager.setCookie
HeadlessInAppWebView.webViewController can now be null.
HeadlessInAppWebView.webViewController
Makes all PrintJobSettings properties optional.
PrintJobSettings
Makes all PullToRefreshSettings properties optional.
PullToRefreshSettings
Makes all WebAuthenticationSessionSettings properties optional.
WebAuthenticationSessionSettings
Replaces the Uri type with the new WebUri class across the API.
WebUriUri
ChromeSafariBrowser.onCompletedInitialLoad now passes an optional argument, changing the event callback signature.
ChromeSafariBrowser.onCompletedInitialLoad
ChromeSafariBrowserMenuItem.action and ChromeSafariBrowserActionButton.action can now be null.
ChromeSafariBrowserMenuItem.actionChromeSafariBrowserActionButton.action
All ChromeSafariBrowserSettings properties are now optional.
ChromeSafariBrowserSettings
WebResourceResponse.contentType and WebResourceResponse.contentEncoding can now be null.
WebResourceResponse.contentTypeWebResourceResponse.contentEncoding
Makes all InAppWebViewSettings and InAppBrowserSettings properties optional.
InAppWebViewSettingsInAppBrowserSettings
Makes InAppBrowser.webViewController nullable.
InAppBrowser.webViewController
All properties of GeolocationPermissionShowPromptResponse are now non-nullable.
GeolocationPermissionShowPromptResponse
historyUrl and baseUrl of InAppWebViewInitialData can now be null.
InAppWebViewInitialDatahistoryUrlbaseUrl
Platform5
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.
minSdkVersion
Updates minimum iOS version to 9.0.
Deprecated4
Deprecates InAppWebViewController.clearCache and InAppWebViewSettings.clearCache in favor of clearAllCache.
InAppWebViewController.clearCacheInAppWebViewSettings.clearCacheInAppWebViewController.clearAllCache
Deprecates InAppWebViewSettings.clearSessionCache in favor of CookieManager.removeSessionCookies.
InAppWebViewSettings.clearSessionCacheCookieManager.removeSessionCookies
Deprecates 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