throwIfNot function
Throws an Error if predicate test
is not satisfied
Example:
throwIfNot(n > 1, () => ArgumentError("n must be greater than 0"));
Implementation
void throwIfNot(bool test, Error Function() errorFactoryFunc) {
if (!test) {
throw errorFactoryFunc();
}
}