Environment variables are cool. On the server side you can set some environment variables which will let you switch some functionality or value when deploying to production.
The answer is ".fromEnvironment". For String and bool datatype, Dart gives you a constant constructor called fromEnviorment that reads the environment variable and sets it to your constant.
bool isRelease = const bool.fromEnvironment("releasemode");
But how do you populate "releasemode"?
When you run pub build, simply pass in the environment variable as such
pub build --define releasemode=true
and voila! you have environment variables on the front end!
Now that is pretty cool.
The possibilities are endless, personally I use it to switch from a stage endpoint to a production endpoint when I deploy, but you can use it for anything!