A utility class for safely launching URLs with comprehensive error handling and validation.
This class provides methods to safely launch different types of URLs including web URLs, email addresses, phone numbers, and SMS.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
canLaunch(
String? url) → Future< bool> - Checks if a URL can be launched without actually launching it.
-
isValidUrl(
String? url) → bool - Validates if a string is a valid URL.
-
launch(
String? url, {SafeUrlLaunchMode preferredMode = SafeUrlLaunchMode.externalApplication, SafeUrlLaunchMode? fallbackMode = SafeUrlLaunchMode.inAppWebView, String? webOnlyWindowName}) → Future< bool> - Safely launches a URL with fallback support and proper validation.
-
launchEmail(
String? email, {String? subject, String? body}) → Future< bool> - Safely launches an email client with pre-filled email address.
-
launchPhone(
String? phoneNumber) → Future< bool> - Safely launches the phone dialer with a phone number.
-
launchSms(
String? phoneNumber, {String? message}) → Future< bool> - Safely launches SMS with a phone number and optional message.
-
launchWebUrl(
String? url, {String? webOnlyWindowName}) → Future< bool> - Safely launches a web URL in the browser.
-
launchWithFeedback(
BuildContext? context, String? url, {String? errorMessage, SafeUrlLaunchMode preferredMode = SafeUrlLaunchMode.externalApplication, SafeUrlLaunchMode? fallbackMode = SafeUrlLaunchMode.inAppWebView}) → Future< void> - Launches a URL with user feedback via SnackBar.