throwIf function

void throwIf(
  1. bool test,
  2. Error errorFactoryFunc(
      )
    )

    Throws an Error if predicate test is satisfied

    Example:

    throwIf(n < 1, () => ArgumentError("n must be greater than 0"));
    

    Implementation

    void throwIf(bool test, Error Function() errorFactoryFunc) {
      return throwIfNot(!test, errorFactoryFunc);
    }