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

How to user Flutter_dotenv on Web #75

Open
reiko-dev opened this issue Oct 30, 2022 · 3 comments
Open

How to user Flutter_dotenv on Web #75

reiko-dev opened this issue Oct 30, 2022 · 3 comments

Comments

@reiko-dev
Copy link

reiko-dev commented Oct 30, 2022

Do I need some additional step for using this package on web?

I'm running it on Android/IOS and all goes fine.

But when I try to run the project on Web I get the follwing errors:

3  Locations: No module for http://localhost:58501/dart_sdk.js 

Locations: No module for http://localhost:58501/dart_sdk.js 

Locations: No module for http://localhost:58501/dart_sdk.js 

Locations: No module for http://localhost:58501/dart_sdk.js 

109  Locations: No module for http://localhost:58501/dart_sdk.js 

Locations: No module for http://localhost:58501/

image

The code for loading the dotenv files is:
await dotenv.load( fileName: 'assets/${kReleaseMode ? 'prod.env' : 'dev.env'}', );

My env files are under the assets folder
image

The files are also added to pubspec.yaml as:

image

@jstdk
Copy link

jstdk commented Nov 4, 2022

Same question here. Can't get it to work on Vercel & Netlify

@robert-virkus
Copy link

In may case I had to move the .env file into the root of my project, then it worked fine.
So in pubspec.yaml I have:

  assets:
    - .env

@z85510
Copy link

z85510 commented Jul 6, 2024

If somebody else reached out here, here is your answer : ##95 (comment)

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