Closed ChemoCosmo closed 3 years ago
Nevermind, ensureInitialized
does the trick. A little bit nasty to run the main method asynchronously though.
void main() async {
await EasyLocalization.ensureInitialized();
runApp(EasyLocalization(
[...]
Remove this issue at will. It might be helpful to others though to find this (new) error message and its solution.
Why authors did not mention this one? I did your trick and it worked thanks.
@ChemoCosmo Thank you! that worked :) @nijatmursali The author added this in 3.0.0 release https://pub.dev/packages/easy_localization/changelog
It can be edited in addition to the @ChemoCosmo so that it does not give a null error
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
runApp(EasyLocalization(
[...]
After upgrading the Dart-SDK to null-safety and upgrading EasyLocalisation to version 3.0.0 in the process my app crashes on startup with:
My main.dart looks as follows:
ConstJsonAssetLoader
is just a costum asset loader that reads translations from constants instead of parsing files for performance reasons (hence thepath: 'none'
). I do not think that is the issue here.The problem occurs in the Android Emulator 30.5.3-7196367 with an Android 11.0 (R) - API 30 Nexus 5X device. Default locale there is de-US.
A workaround is the usage of startLocale-Parameter but I'd rather use device locale.