Created
May 26, 2024 04:57
-
-
Save yjbanov/22e076c2db55cf2d8d773e922472d5d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pragma('dart2js:tryInline') | |
bool get assertionsEnabled { | |
var enabled = false; | |
assert(enabled = true); | |
return enabled; | |
} | |
// Elsewhere | |
void main() { | |
if (assertionsEnabled) { | |
// assert here; this code will be tree shaken off | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment