letUriOrNull function
Let's you convert input
to a Uri type if possible, or returns null
if
the conversion cannot be performed.
Implementation
Uri? letUriOrNull(dynamic input) {
if (input is Uri) return input;
if (input is String) return Uri.tryParse(input.trim());
return null;
}