catch launch exception

This commit is contained in:
Fabian Freund
2025-12-18 18:37:09 +01:00
parent 606df87bd7
commit 2f1ecd50e1
+6
View File
@@ -139,11 +139,17 @@ Future<void> launchUrlFeedback(
LaunchMode mode = LaunchMode.externalApplication, LaunchMode mode = LaunchMode.externalApplication,
}) async { }) async {
if (await canLaunchUrl(url)) { if (await canLaunchUrl(url)) {
try {
if (!await launchUrl(url, mode: mode)) { if (!await launchUrl(url, mode: mode)) {
if (context.mounted) { if (context.mounted) {
showErrorMessage(context, 'Could not launch URL ($url)'); showErrorMessage(context, 'Could not launch URL ($url)');
} }
} }
} catch (e) {
if (context.mounted) {
showErrorMessage(context, 'Could not launch URL ($url)');
}
}
} else { } else {
if (context.mounted) { if (context.mounted) {
showErrorMessage(context, 'Can not handle "${url.scheme}"'); showErrorMessage(context, 'Can not handle "${url.scheme}"');