buttonUp method Null safety

  1. @override
void buttonUp(
  1. Operation key
)
override

Implementation

@override
void buttonUp(Operation key) {
  if (_running) {
    return;
  }
  if (program.lines == 0) {
    model.displayDisabled = false;
    _onDone(null);
  } else {
    _running = true;
    final spr = _fake.real.suspendedProgramRunner;
    ProgramInstruction<Operation> instr = program[program.currentLine];
    if (instr.op == Operations.rs) {
      stackLiftEnabled = true;
    }
    if (spr == null) {
      assert(!program.isRunning);
      program.adjustStackForRunStopStarting();
      final s = Running.singleStep(_fake, GosubProgramRunner(), _onDone);
      s.buttonUp(key);
    } else {
      spr.restart(_fake, singleStepOnDone: _onDone);
    }
  }
}