I am using Flutter and I want to perform a specific task only in debug mode How I can execute code only in debug mode?
2 Answers
You can use assert which only works in debug mode.
assert(() {
// This block only runs in debug mode.
return true;
}());
1 Comment
CopsOnRoad
This answer also provides other ways of checking it.