Detect during runtime whether the application is in release mode or not Detect during runtime whether the application is in release mode or not dart dart

Detect during runtime whether the application is in release mode or not


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