checkThrow function

void checkThrow(
  1. bool condition,
  2. Object callback()
)

Asserts that condition is true.

Throws the return value of callback if condition is false.

Implementation

void checkThrow(final bool condition, final Object Function() callback) {
  if (!condition) {
    throw callback();
  }
}