Sometimes, open the url in a browser is not the best option. For example: an OGG audio file has no player support in iOS browsers, so we could open a flutter dialog to play the file correctly (using a VLC player or other third party plugin).
With the overrideUrlLoading param, we can add custom behavior to urls without affecting the natural flow.
The updates were basically in 3 places:
final Future<bool> Function(Uri uri)? overrideUrlLoading; // line 86 - the new optional widget param
// ...
this.overrideUrlLoading, // line 107 - the new optional widget param in constructor
// ...
// lines 260 to 276
var overridden = widget.overrideUrlLoading == null
? false
: await widget.overrideUrlLoading!(navigationAction.request.url!);
if (!overridden) {
if (navigationAction.navigationType ==
NavigationType.LINK_ACTIVATED) {
if (await launchUrl(navigationAction.request.url!)) {
// We launched the browser, so we don't navigate to the URL in the WebView
return NavigationActionPolicy.CANCEL;
} else {
// We couldn't launch the external browser, so as a fallback we're using the default action
return NavigationActionPolicy.ALLOW;
}
}
return NavigationActionPolicy.ALLOW;
}
return NavigationActionPolicy.CANCEL;
All the other updates was just the VS Code formatOnSave editor setting in action.
Sometimes, open the url in a browser is not the best option. For example: an OGG audio file has no player support in iOS browsers, so we could open a flutter dialog to play the file correctly (using a VLC player or other third party plugin). With the
overrideUrlLoading
param, we can add custom behavior to urls without affecting the natural flow.The updates were basically in 3 places:
All the other updates was just the VS Code
formatOnSave
editor setting in action.