toLocaleList method
Transforms a List of Localization
s into a List of Locale
s.
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();