runCached method

void runCached(
  1. VoidCallback run
)

Runs the given callback using cached results.

While in this callback, this FinderBase will cache the results from the next call to evaluate or tryEvaluate and then no longer evaluate new results until the callback completes. After the first call, all calls to evaluate, tryEvaluate or found will return the same results without evaluating.

Implementation

void runCached(VoidCallback run) {
  reset();
  _cached = true;
  try {
    run();
  } finally {
    reset();
    _cached = false;
  }
}