Easy_localization: Error, containsKey on null object

Created on 31 May 2020  ยท  1Comment  ยท  Source: aissat/easy_localization

I received this issue:
`โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by widgets library โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
The following NoSuchMethodError was thrown building AboutPage(dirty):
The method 'containsKey' was called on null.
Receiver: null
Tried calling: containsKey("about")

The relevant error-causing widget was:
AboutPage file:///Users/ti/Documents/work/bitsens/daycounter/lib/router/app_router.dart:52:33
When the exception was thrown, this was the stack:

0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)

1 Translations.isNestedKey (package:easy_localization/src/translations.dart:40:22)

2 Translations.get (package:easy_localization/src/translations.dart:7:8)

3 Localization._resolve (package:easy_localization/src/localization.dart:92:36)

4 Localization.tr (package:easy_localization/src/localization.dart:37:13)`

My Json is:
{ "about": "About" }
LocaleKeys and CodegenLoader generated correctly.

Here is my main class: runApp(EasyLocalization( supportedLocales: AppLocalization.supportedLocales, path: AppLocalization.path, assetLoader: CodegenLoader(), fallbackLocale: AppLocalization.supportedLocales[0], child: App()));

Could you please help me with that?

Most helpful comment

Resolved. I had Locale('en', 'Us') instead of Locale('en').

>All comments

Resolved. I had Locale('en', 'Us') instead of Locale('en').

Was this page helpful?
0 / 5 - 0 ratings