Skip to content

Upgrading flutter_inappwebview 4 to 5

Breaking4.0.0+4 → 5.8.0Breaking44Security1Platform6Deprecated3New49Changed12Fixed134Other12

BreakingUpgrade verdict

40 breaking changes and 6 platform requirement changes and a security fix.

  • Singleton classes can no longer be created directly with a plain constructor, preventing misuse.
  • Cookie methods no longer require a domain, and no default domain is applied.
  • Headless web view event handlers can now be reassigned after creation.
  • The package no longer pulls in four helper libraries, so projects that relied on them being installed indirectly must add them directly.
Top 5 of 50 that need code or config changes

Dart SDK requirement changed in 5.4.0: >=2.7.0 <3.0.0 → >=2.14.0 <3.0.0.

Flutter requirement changed in 5.7.0: >=1.12.13+hotfix.5 → >=3.0.0.

Breaking40
Removes unnamed constructors for all Singleton classes to avoid incorrect usage.
Makes the domain argument optional and without a default value in CookieManager.getCookie, deleteCookie and deleteCookies.
CookieManager.getCookieCookieManager.deleteCookieCookieManager.deleteCookies
Removes the final keyword from all HeadlessInAppWebView events.
HeadlessInAppWebView
Removes the uuid, device_info, intl, and mime dependencies.
uuiddevice_infointlmime
Moves the progressBar InAppBrowser option from Android-specific to cross-platform and renames it to hideProgressBar.
progressBarhideProgressBar
Renames HttpAuthChallenge to URLAuthenticationChallenge.
HttpAuthChallengeURLAuthenticationChallenge
Renames the ShouldOverrideUrlLoadingAction class to NavigationActionPolicy.
ShouldOverrideUrlLoadingActionNavigationActionPolicy
Renames the ProtectionSpace class to URLProtectionSpace.
ProtectionSpaceURLProtectionSpace
Renames ProtectionSpaceHttpAuthCredentials to URLProtectionSpaceHttpAuthCredentials.
ProtectionSpaceHttpAuthCredentialsURLProtectionSpaceHttpAuthCredentials
Renames the CreateWindowRequest class to CreateWindowAction.
CreateWindowRequestCreateWindowAction
Renames the initialUrl WebView attribute to initialUrlRequest and changes its type to URLRequest.
initialUrlinitialUrlRequestURLRequest
Renames the toolbarTop InAppBrowser cross-platform option to hideToolbarTop.
toolbarTophideToolbarTop
Renames the toolbarBottom InAppBrowser iOS-specific option to hideToolbarBottom.
toolbarBottomhideToolbarBottom
Removes the debuggingEnabled WebView option; Android now uses AndroidInAppWebViewController.setWebContentsDebuggingEnabled(bool), and iOS debugging is always enabled.
debuggingEnabledAndroidInAppWebViewController.setWebContentsDebuggingEnabled(bool debuggingEnabled)
Removes the androidOnRequestFocus event because it is never called.
androidOnRequestFocus
Removes the initialHeaders WebView attribute; use the URLRequest.headers attribute instead.
initialHeadersURLRequest.headers
Removes the headers argument from the loadFile WebView method.
loadFile
Removes the headers argument from the openFile InAppBrowser method.
openFile
Removes the headers argument from the loadUrl WebView method, renames url to urlRequest and changes its type to URLRequest.
loadUrlurlRequestURLRequest
Removes the headers argument from the openUrl InAppBrowser method, renames url to urlRequest and changes its type to URLRequest.
openUrlurlRequestURLRequest
Removes the fallback argument from the ChromeSafariBrowser constructor; check availability yourself to choose a browser.
ChromeSafariBrowser
Removes the scheme argument from the onLoadResourceCustomScheme WebView event; use the Uri url parameter instead.
onLoadResourceCustomSchemeUri url
Removes the ShouldOverrideUrlLoadingRequest class and replaces it with NavigationAction.
ShouldOverrideUrlLoadingRequestNavigationAction
Renames the openUrl InAppBrowser method to openUrlRequest.
openUrlopenUrlRequest
InAppWebViewController.injectJavascriptFileFromAsset now returns Future<dynamic> instead of its previous return type.
InAppWebViewController.injectJavascriptFileFromAssetFuture<dynamic>
FetchRequest.body is now a dynamic type.
FetchRequest.body
Makes InAppBrowser.initialUserScripts, InAppBrowser.id and HeadlessInAppWebView.id final.
InAppBrowser.initialUserScriptsInAppBrowser.idHeadlessInAppWebView.id
Moves allowUniversalAccessFromFileURLs and allowFileAccessFromFileURLs from Android-specific to cross-platform options.
allowUniversalAccessFromFileURLsallowFileAccessFromFileURLs
Adds callAsyncJavaScript to the list of javaScriptHandlerForbiddenNames.
callAsyncJavaScriptjavaScriptHandlerForbiddenNames
Moves the saveWebArchive WebView method from Android-specific to cross-platform.
saveWebArchive
Changes the types of several X509Certificate attributes.
X509CertificatebasicConstraintssubjectKeyIdentifierauthorityKeyIdentifiercertificatePoliciescRLDistributionPointsauthorityInfoAccess
Changes the zoomBy WebView method signature.
zoomBy
Changes the urlFile argument of injectCSSFileFromUrl WebView method to type Uri.
injectCSSFileFromUrlurlFileUriinjectJavascriptFileFromUrl
Changes the return type of the Android-specific getOriginalUrl WebView method to Uri.
getOriginalUrlUrigetSafeBrowsingPrivacyPolicyUrl
Changes the url argument of many WebView events to type Uri, including onLoadStart, onLoadStop, onLoadError and others.
onLoadStartonLoadStoponLoadErroronLoadHttpErroronLoadResourceCustomSchemeonUpdateVisitedHistoryonPrintonPageCommitVisible
Changes the baseUrl and androidHistoryUrl arguments of loadData WebView method and openData InAppBrowser method to type Uri.
loadDataopenDatabaseUrlandroidHistoryUrl
Changes the url argument of the openWithSystemBrowser InAppBrowser method to type Uri.
openWithSystemBrowserUri
Changes all InAppBrowser color options from String to Color.
InAppBrowserChromeSafariBrowser
Updates the attributes of ShouldOverrideUrlLoadingRequest, ServerTrustChallenge and ClientCertChallenge.
ShouldOverrideUrlLoadingRequestServerTrustChallengeClientCertChallenge
Changes the url attribute to Uri for JsAlertRequest, JsAlertConfirm and JsPromptRequest.
JsAlertRequestJsAlertConfirmJsPromptRequesturl
Security1
Removes the unsafe trust manager on Android.
Platform6
Raises the minimum Flutter version to 3.0.0.
Adds support for Android 33.
Updates Android compileSdkVersion to 31.
compileSdkVersion
Builds on and supports Android 12 SDK 31.
Adds support for Dart null safety.
Raises the minimum Flutter version to 1.22.2 and Dart SDK to >=2.12.0-0 <3.0.0.
Deprecated3
Adds the onDownloadStartRequest event and deprecates the old onDownloadStart event.
onDownloadStartRequestonDownloadStart
Deprecates the androidOnScaleChanged WebView event in favor of the new onZoomScaleChanged event, available on Android and iOS.
androidOnScaleChangedonZoomScaleChanged
Deprecates the getScale WebView method in favor of the new getZoomScale method.
getScalegetZoomScale