nullable locale verification for language selection

This commit is contained in:
Daniel Borges 2019-08-11 13:57:13 -03:00
parent d02d3b240b
commit 33630a83ff
1 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,9 @@ void main() => runApp(
GlobalWidgetsLocalizations.delegate,
],
localeResolutionCallback: (locale, supportedLocales) {
if (locale == null) {
return supportedLocales.first;
}
List<Locale> sameLanguageLocales = [];
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode) {