state static method

void state(
  1. bool expression,
  2. String message
)

Asserts that a boolean expression is true.

Throws a NoGuaranteeException with the provided message if the expression evaluates to false.

Example:

Assert.state(user.isActive, 'User must be active');

Implementation

static void state(bool expression, String message) {
  if (!expression) {
    throw NoGuaranteeException(message);
  }
}