safeDecodeUri function
Decodes a percent-encoded URI component value, returning null on failure.
Unlike urlDecodeComponent this never throws on malformed escapes; the failure is logged and null is returned.
Example:
safeDecodeUri('a%20b'); // 'a b'
safeDecodeUri('%'); // null
Implementation
String? safeDecodeUri(String value) {
try {
return Uri.decodeComponent(value);
} on Object catch (e) {
dev.log(_kLogSafeDecodeUriFailed, error: e);
return null;
}
}