kReleaseMode top-level constant
A constant that is true if the application was compiled in release mode.
More specifically, this is a constant that is true if the application was compiled in Dart with the '-Ddart.vm.product=true' flag.
Since this is a const value, it can be used to indicate to the compiler that a particular block of code will not be executed in release mode, and hence can be removed.
Generally it is better to use kDebugMode or assert
to gate code, since
using kReleaseMode will introduce differences between release and profile
builds, which makes performance testing less representative.
See also:
- kDebugMode, which is true in debug builds.
- kProfileMode, which is true in profile builds.
Implementation
const bool kReleaseMode = bool.fromEnvironment('dart.vm.product');