withPhase method

bool withPhase(
  1. WorkPhase phase,
  2. FutureOr exec()
)

Implementation

bool withPhase(WorkPhase phase, FutureOr exec()) {
  if (this.workPhase < phase) {
    log.info("Advancing phase: $phase: we are ${this.currentStatus.phase}");
    this.workPhase = phase;
    this.sendStatus();
    exec();
    return true;
  } else {
    log.info("Wrong phase: $phase but we were ${this.currentStatus.phase}");
    return false;
  }
}