Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter easy localization Source path does not exist

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()));
like image 920
Atiq Ur Rehman Avatar asked Jun 06 '20 12:06

Atiq Ur Rehman


2 Answers

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
like image 102
Atiq Ur Rehman Avatar answered Oct 17 '22 04:10

Atiq Ur Rehman


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

like image 38
xkxeeshankhan Avatar answered Oct 17 '22 04:10

xkxeeshankhan