isDebugMode top-level property
bool
get
isDebugMode
Similar to Flutter's kDebugMode, but without relying on vm's properties.
This implementation is based on the fact that the assert
function is
disabled in release mode.
Implementation
bool get isDebugMode {
try {
assert(false, 'if this throws, then we are in debug mode');
return false;
// ignore: avoid_catching_errors - we intentionally throw for the logic
} on AssertionError catch (_) {
return true;
}
}