TL;DR
You can use the LaunchMode.externalApplication parameter.
await launchUrl(_url, mode: LaunchMode.externalApplication);
More info
By default the mode value is set to LaunchMode.platformDefault, which in most cases is an inAppWebView.
Changing the mode solved this issue:
Future<void> openUrl(String url) async {
final _url = Uri.parse(url);
if (!await launchUrl(_url, mode: LaunchMode.externalApplication)) { // <--
throw Exception('Could not launch $_url');
}
}
LaunchMode support several arguments:
enum LaunchMode {
/// Leaves the decision of how to launch the URL to the platform
/// implementation.
platformDefault,
/// Loads the URL in an in-app web view (e.g., Safari View Controller).
inAppWebView,
/// Passes the URL to the OS to be handled by another application.
externalApplication,
/// Passes the URL to the OS to be handled by another non-browser application.
externalNonBrowserApplication,
}