I'm trying to add Spanish to my flutter project with easy_localization i added JSON files of US and ES and added the path to it in runApp function as I try to generate keys with flutter
pub run easy_localization:generate
runApp(EasyLocalization(
supportedLocales: [Locale('en', 'US'), Locale('es', 'ES')],
path: 'assets/translations/',
fallbackLocale: Locale('en', 'US'),
child: MyApp()));
simply just put the path of the folder where localization files are, in my case.
flutter pub run easy_localization:generate --source-dir ./assets/translations
In case someone get the same error while generating locale_keys.g.dart
use the below code:
flutter pub run easy_localization:generate -S assets/translations -f keys -o locale_keys.g.dart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With