tryParse method Null safety

Locale? tryParse(
  1. String localeIdentifier
)

Parses Unicode Locale Identifiers to produce Locale instances.

Returns null if localeIdentifier is syntactically invalid.

Implementation

static Locale? tryParse(String localeIdentifier) {
  ArgumentError.checkNotNull(localeIdentifier);
  var parser = LocaleParser(localeIdentifier);
  return parser.toLocale();
}