Launch URL: In-app vs External

Best Practices

Hi Everyone!

(Beginner FF dev here )

After the March 7th update, I noticed my "launch URL" actions (which previously executed in an external browser window), were now opening via in-app browser (or webview).

This has resulted in broken navigation back to the app, in my case after an Oauth. When the URL opened in an external browser, I had the option to use firebase dynamic links (app.page.link), or deep links (app(:)//app.com/page), however both of these URL schemes appear not to be supported by the in-app browser (ERR_UNKNOWN_URL_SCHEME) with both url schemes.

I wrote a simple custom action to forece the url to launch in an external browser, and an happy to share it with the FF community :)

Be sure to create a parameter called urlString (set to String type). If your URL is not wrapped in double quotes, ensure that the value you pass to urlString when you call the function, you can use the Text Combination function manage that.

Custom Action: launchInExternalBrowser


import 'package:url_launcher/url_launcher.dart';

Future<void> launchInExternalBrowser(String urlString) async {

  final Uri uri = Uri.parse(urlString);

  await launchUrl(uri, mode: LaunchMode.externalApplication);

}
4
5 replies