Logo

Programming-Idioms

History of Idiom 123 > diff from v13 to v14

Edit summary for version 14 by cpt.FooBar:
New Dart implementation by user [cpt.FooBar]

Version 13

2019-09-27, 06:28:33

Version 14

2019-09-27, 10:06:20

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Idiom #123 Assert condition

Verify that predicate isConsistent returns true, otherwise report assertion violation.
Explain if the assertion is executed even in production environment or not.

Code
assert(isConsistent)
Comments bubble
Needs to be executed with "--enable-asserts" flag with dart and dart2js commands.
In Flutter it will execute only in debug mode.
dartdevc (development compiler) will execute it by default.
Doc URL
https://dart.dev/guides/language/language-tour#assert