parseUri function
Parses a URI from the given value and returns it as a Uri.
- Throws a FormatException if the
valueis empty or contains an invalid URI.
Implementation
Uri parseUri(final String value) {
if (value.isEmpty) {
throw const FormatException('Value cannot be empty');
}
try {
return Uri.parse(value);
} catch (e) {
throw const FormatException('Invalid URI format');
}
}