From 33630a83ff61e389bc5321ebfc126ff3ed6e1f0a Mon Sep 17 00:00:00 2001 From: Daniel Borges Date: Sun, 11 Aug 2019 13:57:13 -0300 Subject: [PATCH] nullable locale verification for language selection --- lib/main.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/main.dart b/lib/main.dart index 4ee3b3e..18433dc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -41,6 +41,9 @@ void main() => runApp( GlobalWidgetsLocalizations.delegate, ], localeResolutionCallback: (locale, supportedLocales) { + if (locale == null) { + return supportedLocales.first; + } List sameLanguageLocales = []; for (var supportedLocale in supportedLocales) { if (supportedLocale.languageCode == locale.languageCode) {