void checkNotNegative(int value, [ String name, String message ])

Check that an integer value isn't negative.

Throws if the value is negative.

Source

static void checkNotNegative(int value, [String name, String message]) {
  if (value < 0) throw new RangeError.range(value, 0, null, name, message);
}