Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang/ asset not found #15

Open
neilbeukes opened this issue Aug 24, 2021 · 3 comments
Open

lang/ asset not found #15

neilbeukes opened this issue Aug 24, 2021 · 3 comments

Comments

@neilbeukes
Copy link

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
Copy link
Contributor

ahmadalibaloch commented Sep 1, 2021

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

  assets:
      - lang/

ff

@arturjnt
Copy link

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
Copy link
Owner

@arturjnt thanks a lot for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants