Skip to content

The getter 'languageCode' was called on null flutter for iOS #39032

@vprudnikoff

Description

@vprudnikoff

Hello!
Still have the error with localization for Flutter iOS application (for Android everything works fine).
My code for App widget:

...
@override
  Widget build(BuildContext context) {
    _initGlobalConstants();
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
    _bloc.dispatch(AppEventStarted());
    return MaterialApp(
      supportedLocales: [
        Locale('en', 'US'),
        Locale('ru', 'RU')
      ],
      localizationsDelegates: [
        AppLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate
      ],
      localeResolutionCallback: (locale, supportedLocales) {
        for (var supportedLocale in supportedLocales) {
          if (supportedLocale.languageCode == locale.languageCode) {
            return supportedLocale;
          }
        }
        return supportedLocales.first;
      } 
...

The point is that when I try to launch it with some breakpoints, everything works good and locale is not null. But when I try the same without any breakpoints, I have error inside localeResolutionCallback - The getter 'languageCode' was called on null. Tried several times some tips about this issue for iOS:

  1. Added
<key>CFBundleLocalizations</key>
	<array>
		<string>English</string>
		<string>ru</string>
	</array> 
...

for Info.plst
2) Added locales support for iOS project.

But nothing helped.
Don't know what to do. Localization is very important, I thing, but it's so ugly for Flutter now.

Metadata

Metadata

Assignees

Labels

a: internationalizationSupporting other languages or locales. (aka i18n)customer: crowdAffects or could affect many people, though not necessarily a specific customer.engineflutter/engine related. See also e: labels.platform-iosiOS applications specifically

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions