preferredLanguagesAsLocales property

Future<List<Locale>> preferredLanguagesAsLocales

Return a List of Locales based on the list of preferred languages This is the same list returned by preferredlanguages but as a Locales rather than Strings

On Linux, returns the current locale.

Implementation

static Future<List<Locale>> get preferredLanguagesAsLocales async {
  final String? defaultLocale = await _channel.invokeMethod('currentLocale');
  final List? version = await _channel.invokeMethod('preferredLanguages');
  if (version == null) {
    return [];
  }
  return version
      .map((locale) {
        return _getAsLocale(locale, defaultLocale);
      })
      .toList()
      .cast<Locale>();
}