java-james / flutter_dotenv

Loads environment variables from `.env`.
https://pub.dartlang.org/packages/flutter_dotenv
MIT License
209 stars 46 forks source link

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404. #95

Open YawarOsman opened 5 months ago

YawarOsman commented 5 months ago

When i try to load my .env file it shows this error:

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404.

I have added this too:

  assets:
    - .env
nghiashiyi commented 5 months ago

When i try to load my .env file it shows this error:

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/.env". HTTP request succeeded, but the server responded with HTTP status 404.

I have added this too:

  assets:
    - .env

Same issue

MilanHofmann commented 5 months ago

Same for me.

Error while trying to load an asset: Flutter Web engine failed to fetch "assets/assets/dotenv". HTTP request succeeded, but the server responded with HTTP status 404.

But my flutter web service worker has "assets/assets/dotenv": "4ef2f78446edff171436088341b541e3" in it's resources...?

wj-yang-pro commented 5 days ago

Same here,

I found that changing the file name to 'env' works on firebase web projects

https://{host}/assets/.env -> http 404 https://{host}/assets/env -> http 200

not sure if it is a firebase hosting problem

overall, I need to change env filename: .env to env pubspec.yaml

  assets:
    - env

and code:

await dotevn.load(fileName: 'env')