Locale.parse constructor

Locale.parse(
  1. String identifier
)

Parse a string into a locale.

identifier must be a string containing an identifier matching Locale.identifier for one of the listed locales.

Implementation

factory Locale.parse(String identifier) => Locale.values.firstWhere(
      (locale) => locale.identifier == identifier,
      orElse: () => throw FormatException('Unknown Locale', identifier),
    );