I got a bunch of tests and debug stuff in my Dart application and I would like to make sure these kind of things are disabled when I build a release version with pub.
Is there any constant or some other way to check if the current running version of the application is a release build or not?
Example:
if (!IS_BUILD) {
   performAutomatedDummyLogin()
} else {
   login();
}
Code in assert(...); is only executed in checked (development) mode. When you run in release mode or build in release mode this code isn't executed.
bool isRelease = true;
assert(() {
  isRelease = false;
  return true;
});
if(isRelease) {
 ...
} 
see also
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With