runSubroutine method Null safety

  1. @override
Future<double> runSubroutine(
  1. double arg
)
override

Implementation

@override
Future<double> runSubroutine(double arg) async {
  const okErrors = {0, 1};
  try {
    final r = await super.runSubroutineErrorsOK(arg, okErrors);
    return r;
  } on CalculatorError catch (e) {
    if (!okErrors.contains(e.num15)) {
      rethrow;
    }
    while (returnStackStartPos < model.program.returnStackPos + 1) {
      model.program.popReturnStack();
    }
    return double.infinity;
  }
}