check before launch url
This commit is contained in:
@@ -17,9 +17,15 @@ Future<void> launchUrlFeedback(
|
|||||||
Uri url, {
|
Uri url, {
|
||||||
LaunchMode mode = LaunchMode.externalApplication,
|
LaunchMode mode = LaunchMode.externalApplication,
|
||||||
}) async {
|
}) async {
|
||||||
if (!await launchUrl(url, mode: mode)) {
|
if (await canLaunchUrl(url)) {
|
||||||
|
if (!await launchUrl(url, mode: mode)) {
|
||||||
|
if (context.mounted) {
|
||||||
|
showErrorMessage(context, 'Could not launch URL ($url)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
showErrorMessage(context, 'Could not launch URL ($url)');
|
showErrorMessage(context, 'Can not handle "${url.scheme}"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user