parse static method

Locale parse(
  1. String localeIdentifier
)

Parses Unicode Locale Identifiers to produce Locale instances.

Throws a FormatException if localeIdentifier is syntactically invalid.

Implementation

static Locale parse(String localeIdentifier) {
  ArgumentError.checkNotNull(localeIdentifier);
  var parser = LocaleParser(localeIdentifier);
  var locale = parser.toLocale();
  if (locale == null) {
    throw FormatException('Locale "$localeIdentifier": '
        '${parser.problems.join("; ")}.');
  }
  return locale;
}