checkThrow function
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();
}
}