safeLaunchUri function
Future<void>
safeLaunchUri(
- Uri uri, {
- LaunchMode mode = LaunchMode.platformDefault,
- bool showError = false,
- String? defaultErrorText,
Implementation
Future<void> safeLaunchUri(Uri uri,
{LaunchMode mode = LaunchMode.platformDefault,
bool showError = false,
String? defaultErrorText}) async {
try {
await launchUrl(uri, mode: mode);
} on Exception catch (error) {
if (showError) {
if (kDebugMode) {
App.dialog.showError(error);
} else {
App.dialog.showError(defaultErrorText ?? error);
}
}
}
}