create_flutter_provider_app icon indicating copy to clipboard operation
create_flutter_provider_app copied to clipboard

lang/ asset not found

Open neilbeukes opened this issue 4 years ago • 3 comments
trafficstars

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?

neilbeukes avatar Aug 24 '21 05:08 neilbeukes

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

  assets:
      - lang/

ff

ahmadalibaloch avatar Sep 01 '21 12:09 ahmadalibaloch

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');

arturjnt avatar Sep 17 '21 07:09 arturjnt

@arturjnt thanks a lot for the suggestion.

KenAragorn avatar Sep 29 '21 06:09 KenAragorn