toLocaleList method

List<Locale> toLocaleList()

Transforms a List of Localizations into a List of Locales.

Usually used on MaterialApp's supportedLocales:

return MaterialApp(
  title: loc.appName,
  // Add this line so the platform knows the supported languages
  supportedLocales: Localization.localizations.toLocaleList(),
  theme: ...,
  home: Home(),
);

Implementation

List<Locale> toLocaleList() => map((e) => e.toLocale()).toList();