checkState static method

void checkState(
  1. bool condition,
  2. Object? message
)

Throws a StateError with message unless condition holds.

Implementation

static void checkState(bool condition, Object? message) {
  if (!condition) {
    throw StateError('$message');
  }
}