ExternalLaunchException class
Exception thrown when launching an external URL or application fails.
Represents failures when attempting to open external links, email clients, or other platform-specific URL schemes. This exception captures detailed context about what was attempted and why it failed.
Common scenarios include the device lacking an app to handle the URL scheme, invalid or malformed URLs, platform restrictions, or denied permissions.
Example:
try {
await launchUrl(Uri.parse('tel:+1234567890'));
} catch (e) {
throw ExternalLaunchException(
action: 'call',
uri: Uri.parse('tel:+1234567890'),
reason: 'No phone app available',
originalError: e,
);
}
See also:
launchURLandsendEmailinurl_launcher.dartfor launching utilities.
- Inheritance
-
- Object
- AppException
- ExternalLaunchException
Constructors
- ExternalLaunchException({required String action, required Uri uri, String? message, String? reason, Object? originalError, StackTrace? originalStackTrace})
-
Creates an exception for an external launch failure.
const
Properties
- action → String
-
A short description of the attempted action, such as
'launch_url'or'send_email'.final - hashCode → int
-
The hash code for this object.
no setterinherited
- message → String
-
A human-readable description of the error.
finalinherited
- originalError → Object?
-
The underlying exception that caused the launch failure, or
nullif the failure was detected without an exception being thrown.final - originalStackTrace → StackTrace?
-
The stack trace from the original error, or
nullif unavailable.final - reason → String?
-
An optional explanation of why the launch failed.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- uri → Uri
-
The URI that failed to launch.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
The detailed string representation of this exception for debugging.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited