kReleaseMode top-level constant

bool const kReleaseMode

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:

Implementation

const bool kReleaseMode = bool.fromEnvironment('dart.vm.product');