handleCHS method Null safety

  1. @override
void handleCHS()
override

Implementation

@override
void handleCHS() {
  if (!model.isFloatMode) {
    model.lastX = model.x;
    changeState(Resting(controller));
  }
  final int? ex = _exponent;
  if (ex != null) {
    _tryNewValue(_entered, _sign, -ex, !_negativeExponent);
  } else if (_sign == '') {
    bool done = _tryNewValue(_entered, '-', ex, _negativeExponent);
    if (!done) {
      // Happens for hex, oct, bin, and unsigned dec
      model.chsX(); // In unsigned mode this does what the 16C does
      model.display.displayX(flash: false);
      _entered = '';
    }
  } else {
    _tryNewValue(_entered, '', ex, _negativeExponent);
    if (model.xI.isNegative) {
      assert(model.x.internal == model.signMask); // e.g. -32768 for 16 bit
      model.gFlag = true;
    }
  }
}