evaluatePrecondition method Null safety

Future<Precondition> evaluatePrecondition(
  1. Precondition p,
  2. {bool ignoreCache = false}
)

Runs single precondition test. If the test is already running it won't be started again and you will receive the result of already running evaluation. If the test has dependencies, they will be evaluated first. If they fail, your test won't be run at all and it's result will be PreconditionStatus.unsatisfied().

The registerPrecondition.satisfiedCache and registerPrecondition.notSatisfiedCache can also influence whether the precondition will be actually run or not.

Use ignoreCache = true to omit any cached value

Implementation

Future<Precondition> evaluatePrecondition(Precondition p, {bool ignoreCache: false}) async {
  _log.info("Evaluating $p");
  _thisRunCache ??= _RunCache();
  try {
    _thisRunCache!.use();
    notifyListeners();
    await p._evaluate(ignoreCache: ignoreCache);
  } finally {
    _thisRunCache!.release();
  }
  notifyListeners();
  await _releaseRunCache();
  return p;
}