KenAragorn / create_flutter_provider_app

A boilerplate project created in Flutter using Provider and Firebase.
MIT License
400 stars 117 forks source link

lang/ asset not found #15

Open neilbeukes opened 3 years ago

neilbeukes commented 3 years ago

Hi,

I keep getting this error:

image

I have tried to add it in the pubspec file under :

flutter:
   assets:
   - lang/
   // And - assets/lang

any idea what I need to add also?

ahmadalibaloch commented 3 years ago

move the lang folder one level up to parent directory and keep your change in assets

  assets:
      - lang/

ff

arturjnt commented 2 years ago

I propose a different solution @neilbeukes Don't move the folder, and check how I did it here

But long story short: pubspec.yaml

  assets:
    - assets/lang/en.json
    - assets/lang/zh.json

and change line 27 on the app_localizations.dart to

await rootBundle.loadString('assets/lang/${locale.languageCode}.json');
KenAragorn commented 2 years ago

@arturjnt thanks a lot for the suggestion.