checkArgument function

void checkArgument(
  1. bool condition,
  2. String errorMessage
)

Ensures the truth of an expression involving one or more parameters to the calling method.

Implementation

void checkArgument(bool condition, String errorMessage) {
  if (!condition) {
    throw ArgumentError(errorMessage);
  }
}