handleRunStop method Null safety

  1. @override
void handleRunStop()
override

Implementation

@override
void handleRunStop() {
  final program = model.memory.program;
  assert(!program.isRunning);
  program.adjustStackForRunStopStarting();
  if (program.currentLine == 0 && program.lines > 0) {
    program.currentLine = 1;
    // On the 15C, if R/S is pressed just before the phantom RTN of an
    // integrate function that runs off the end of memory, it does *not*
    // handle it gracefully - it just wraps like this.
  }
  program.displayCurrent();
  final rc = controller as RealController;
  final spr = rc.suspendedProgramRunner;
  if (spr == null) {
    changeState(Running(rc, GosubProgramRunner()));
  } else {
    final running =
        spr.restart(RunningController(controller as RealController));
    changeState(Resumed(running, rc));
  }
}