isTrue static method

void isTrue(
  1. bool assertion, [
  2. String? message
])

Throws an AssertionFailedException with the given message if the given assertion is not true.

@param assertion a condition that is supposed to be true @param message a description of the assertion @throws AssertionFailedException if the condition is false

Implementation

static void isTrue(bool assertion, [String? message]) {
  if (!assertion) {
    if (message == null) {
      assert(true);
    } else {
      assert(true, message);
    }
  }
}