itThrows function

bool itThrows(
  1. void callback()
)

Calls callback and returns true if it throws.

Implementation

bool itThrows(void Function() callback) {
  try {
    callback();
    return false;
  } catch (_) {
    return true;
  }
}