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

Unable to rebuild envs #6

Open
mikymod opened this issue Nov 17, 2020 · 6 comments
Open

Unable to rebuild envs #6

mikymod opened this issue Nov 17, 2020 · 6 comments

Comments

@mikymod
Copy link

mikymod commented Nov 17, 2020

Hi!
If I change values in .env and rebuild with:
flutter pub run build_runner build
or:
flutter pub run build_runner build --delete-conflicting-outputs
env.g.dart doesn't change at all.
It's intended?
Thanks in advance

@frencojobs
Copy link
Owner

It is because the builder reads the .env files using dart:io and not as an asset. So, the snapshots are using the old .env files as long as the env.dart is not changed. I'm finding a way to read .env files as assets but it's still not possible. I'll let you know after I implemented it.

Currently, you could do

flutter pub get

before running build_runner to clear the snapshots.

@aydinfatih

This comment has been minimized.

@arifikhsan

This comment has been minimized.

@frencojobs
Copy link
Owner

frencojobs commented Jun 29, 2021

Sorry for the delay @FatihAydin52, env.dart is where you specify the data you want to take out from .env file. The generator will generate only env.g.dart.

@arifikhsan's reply is a correct way to do this. The README also mentions all those details.

I've marked the replies as off-topic, since it is not related to the current issue or it is in fact not an issue. Thanks!

@billyadx
Copy link

billyadx commented Nov 12, 2021

It is because the builder reads the .env files using dart:io and not as an asset. So, the snapshots are using the old .env files as long as the env.dart is not changed. I'm finding a way to read .env files as assets but it's still not possible. I'll let you know after I implemented it.

Currently, you could do

flutter pub get

before running build_runner to clear the snapshots.

how about this issue? i changed the value at .env but the value at env.dart didn't change at all
i run flutter pub get before build but still doesn't works
please help

UPDATE

it works after i run flutter clean, as @FatihAydin52 said

flutter clean
flutter pub get
flutter pub run build_runner build --delete-conflicting-outputs

@0ttik
Copy link

0ttik commented Feb 22, 2023

It makes package use very sad if you want to switch environment quickly because we need to do full flutter clean which will generate all files and for large project it takes a lot of time.

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

6 participants