tryDecodeComponent static method

String? tryDecodeComponent(
  1. String component
)

Decodes component using Uri.decodeComponent, but returns null if the decoding fails due to non-ASCII characters.

Implementation

static String? tryDecodeComponent(String component) {
  try {
    return Uri.decodeComponent(component);
  } on ArgumentError {
    return null;
  }
}