assert_ method
Asserts that expression is true.
If the expression is false, an AssertionError is thrown with the
optional message.
Note: In C, this is the assert macro. Because assert is a reserved
keyword in Dart, we use assert_ or cassert for implementation,
while still mapping logically to <assert.h>.
Implementation
void assert_(bool expression, [String? message]) {
if (!expression) {
if (message != null) {
throw AssertionError(message);
} else {
throw AssertionError();
}
}
}