onArgComplete method Null safety

  1. @override
void onArgComplete(
  1. OperationArg arg,
  2. int argValue
)
override

Process an Operation that takes an OperationArg, once the argument value is available.

Implementation

@override
void onArgComplete(OperationArg arg, int argValue) {
  const selector = _ArgOperationSelector();
  void Function(Model, int)? f = model.displayMode.select(selector, arg);
  try {
    final p = arg.pressed;
    if (p != null) {
      p(this);
    }
    f!(model, argValue);
    model.display.displayX();
  } on CalculatorError catch (e) {
    controller.showCalculatorError(e);
    // ignore: avoid_catches_without_on_clauses
  } catch (e, s) {
    print('Unexpected exception $e\n\n$s');
    controller.showCalculatorError(CalculatorError(9));
  }
  arg.op.possiblyAlterStackLift(controller);
}