check function

void check(
  1. bool condition, [
  2. Object? message
])

Asserts that condition is true.

Throws an AssertionError with the provided message if condition is false.

Implementation

/// Asserts that [condition] is `true`.
///
/// Throws an [AssertionError] with the provided [message] if [condition] is `false`.
void check(final bool condition, [final Object? message]) {
  if (!condition) {
    throw AssertionError(message);
  }
}