verify method

void verify({
  1. bool ignoreCanceled = false,
})

Throws if a request is unmatched or incomplete, optionally ignoring canceled work.

Implementation

void verify({bool ignoreCanceled = false}) {
  final outstanding = _pending
      .where((item) =>
          !(ignoreCanceled && item.token.isCanceled) &&
          (!item.matched || !item.completed))
      .length;
  if (outstanding > 0) {
    throw StateError(
        '$outstanding unhandled requests. Outstanding: $_outstanding');
  }
}