Skip to content

Commit 07a608b

Browse files
committed
Fixed bug in Localization where Locale.countrycCode is null. Closes #369
1 parent fbe5b6f commit 07a608b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/localization/form_builder_localizations.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import 'package:intl/intl.dart';
66

77
class FormBuilderLocalizations {
88
static Future<FormBuilderLocalizations> load(Locale locale) {
9-
final name =
10-
locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
9+
final name = (locale.countryCode?.isEmpty ?? true)
10+
? locale.languageCode
11+
: locale.toString();
1112
final localeName = Intl.canonicalizedLocale(name);
1213

1314
return initializeMessages(localeName).then((bool _) {

0 commit comments

Comments
 (0)