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.
In plain terms
- 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.
Must act 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.
What you must change
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.deleteCookiesRemoves the final keyword from all HeadlessInAppWebView events.
HeadlessInAppWebViewRemoves the uuid, device_info, intl, and mime dependencies.
uuiddevice_infointlmimeMoves the progressBar InAppBrowser option from Android-specific to cross-platform and renames it to hideProgressBar.
progressBarhideProgressBarRenames HttpAuthChallenge to URLAuthenticationChallenge.
HttpAuthChallengeURLAuthenticationChallengeRenames the ShouldOverrideUrlLoadingAction class to NavigationActionPolicy.
ShouldOverrideUrlLoadingActionNavigationActionPolicyRenames the ProtectionSpace class to URLProtectionSpace.
ProtectionSpaceURLProtectionSpaceRenames ProtectionSpaceHttpAuthCredentials to URLProtectionSpaceHttpAuthCredentials.
ProtectionSpaceHttpAuthCredentialsURLProtectionSpaceHttpAuthCredentialsRenames the CreateWindowRequest class to CreateWindowAction.
CreateWindowRequestCreateWindowActionRenames the initialUrl WebView attribute to initialUrlRequest and changes its type to URLRequest.
initialUrlinitialUrlRequestURLRequestRenames the toolbarTop InAppBrowser cross-platform option to hideToolbarTop.
toolbarTophideToolbarTopRenames the toolbarBottom InAppBrowser iOS-specific option to hideToolbarBottom.
toolbarBottomhideToolbarBottomRemoves 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.
androidOnRequestFocusRemoves the initialHeaders WebView attribute; use the URLRequest.headers attribute instead.
initialHeadersURLRequest.headersRemoves the headers argument from the loadFile WebView method.
loadFileRemoves the headers argument from the openFile InAppBrowser method.
openFileRemoves the headers argument from the loadUrl WebView method, renames url to urlRequest and changes its type to URLRequest.
loadUrlurlRequestURLRequestRemoves the headers argument from the openUrl InAppBrowser method, renames url to urlRequest and changes its type to URLRequest.
openUrlurlRequestURLRequestRemoves the fallback argument from the ChromeSafariBrowser constructor; check availability yourself to choose a browser.
ChromeSafariBrowserRemoves the scheme argument from the onLoadResourceCustomScheme WebView event; use the Uri url parameter instead.
onLoadResourceCustomSchemeUri urlRemoves the ShouldOverrideUrlLoadingRequest class and replaces it with NavigationAction.
ShouldOverrideUrlLoadingRequestNavigationActionRenames the openUrl InAppBrowser method to openUrlRequest.
openUrlopenUrlRequestInAppWebViewController.injectJavascriptFileFromAsset now returns Future<dynamic> instead of its previous return type.
InAppWebViewController.injectJavascriptFileFromAssetFuture<dynamic>FetchRequest.body is now a dynamic type.
FetchRequest.bodyMakes InAppBrowser.initialUserScripts, InAppBrowser.id and HeadlessInAppWebView.id final.
InAppBrowser.initialUserScriptsInAppBrowser.idHeadlessInAppWebView.idMoves allowUniversalAccessFromFileURLs and allowFileAccessFromFileURLs from Android-specific to cross-platform options.
allowUniversalAccessFromFileURLsallowFileAccessFromFileURLsAdds callAsyncJavaScript to the list of javaScriptHandlerForbiddenNames.
callAsyncJavaScriptjavaScriptHandlerForbiddenNamesMoves the saveWebArchive WebView method from Android-specific to cross-platform.
saveWebArchiveChanges the types of several X509Certificate attributes.
X509CertificatebasicConstraintssubjectKeyIdentifierauthorityKeyIdentifiercertificatePoliciescRLDistributionPointsauthorityInfoAccessChanges the zoomBy WebView method signature.
zoomByChanges the urlFile argument of injectCSSFileFromUrl WebView method to type Uri.
injectCSSFileFromUrlurlFileUriinjectJavascriptFileFromUrlChanges the return type of the Android-specific getOriginalUrl WebView method to Uri.
getOriginalUrlUrigetSafeBrowsingPrivacyPolicyUrlChanges the url argument of many WebView events to type Uri, including onLoadStart, onLoadStop, onLoadError and others.
onLoadStartonLoadStoponLoadErroronLoadHttpErroronLoadResourceCustomSchemeonUpdateVisitedHistoryonPrintonPageCommitVisibleChanges the baseUrl and androidHistoryUrl arguments of loadData WebView method and openData InAppBrowser method to type Uri.
loadDataopenDatabaseUrlandroidHistoryUrlChanges the url argument of the openWithSystemBrowser InAppBrowser method to type Uri.
openWithSystemBrowserUriChanges all InAppBrowser color options from String to Color.
InAppBrowserChromeSafariBrowserUpdates the attributes of ShouldOverrideUrlLoadingRequest, ServerTrustChallenge and ClientCertChallenge.
ShouldOverrideUrlLoadingRequestServerTrustChallengeClientCertChallengeChanges the url attribute to Uri for JsAlertRequest, JsAlertConfirm and JsPromptRequest.
JsAlertRequestJsAlertConfirmJsPromptRequesturlSecurity1
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.
compileSdkVersionBuilds 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.
Deprecations to plan for
Deprecated3
Adds the onDownloadStartRequest event and deprecates the old onDownloadStart event.
onDownloadStartRequestonDownloadStartDeprecates the androidOnScaleChanged WebView event in favor of the new onZoomScaleChanged event, available on Android and iOS.
androidOnScaleChangedonZoomScaleChangedDeprecates the getScale WebView method in favor of the new getZoomScale method.
getScalegetZoomScale