Question: best practice for defining environments ?
Closed this issue · 3 comments
Hi.
what I will do in my apps is to defining an ENV
interface and some implementations for that by specifying the flavor via Injectable
package.
as I can see in examples, there are some .env
files, it is the first time that I have seen these files,
can I ask that which one do you prefer to use ?
Thanks
@rodrigorahman u can answer this
There may be more, but generally I think about two good practices:
-
If you want to set variables based on staging, or development or release, just use
--dart-define
. You can read more about it here. -
If you want to execute different code, say configuring InMemory repositories for debug and Remote repositories with get_it, you can define a main for each one of them.
$ flutter run -t lib/development.dart
$ flutter run -t lib/staging.dart
$ flutter run -t lib/release.dart
Closed as Asceno gave an answer and there was no follow up for a while.