toUri function
Uri
toUri(
- dynamic object, {
- Object? mapKey,
- int? listIndex,
- Uri? defaultValue,
- ElementConverter<
Uri> ? converter,
Converts an object to a Uri. mirroring the same static method in the ConvertObject, providing alternative easy less code usage options.
- If the object is a string representing a valid URI, it converts it to a Uri object.
- If the object is
null
, throws aParsingException
with anullObject
error. - If the conversion to Uri fails (e.g., if the string is not a valid URI), throws a
ParsingException
.
object
The object to be converted to a Uri. Expected to be a string representing a URI.
mapKey
(Optional) Specifies the key to extract values from a Map object.
listIndex
(Optional) Specifies the index to extract elements from a List object.
Returns a Uri if conversion is successful.
Throws a ParsingException
if the conversion fails or the object is null.
Implementation
@optionalTypeArgs
Uri toUri(
dynamic object, {
Object? mapKey,
int? listIndex,
Uri? defaultValue,
ElementConverter<Uri>? converter,
}) =>
ConvertObject.toUri(
object,
mapKey: mapKey,
listIndex: listIndex,
defaultValue: defaultValue,
converter: converter,
);