buttonDown method Null safety

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

Implementation

@override
void buttonDown(Operation key) {
  final OperationArg? arg = key.arg;
  if (key == Operations.gto) {
    changeState(WaitingForGotoDot(controller, this));
  } else if (arg != null) {
    // which includes gsb and lbl
    controller.runWithArg(arg, this);
  } else if (_ourPressed.contains(key)) {
    assert(key is LimitedOperation);
    // It has to be, because it's in _ourKeys.  The static typing
    // system doesn't guarantee that for us, because we're using the
    // non-parameterized version of the generic Operation to achieve the
    // needed covariance.
    key.pressed(this);
  } else {
    _addOperation(key, 0);
  }
}