deleteCurrent method Null safety

void deleteCurrent()

Implementation

void deleteCurrent() {
  assert(_lines > 0 && _currentLine > 0);
  final op = opcodeAt(_currentLine); // Sets _cachedAddress
  final extended = op >= 0x100;
  int addr = _cachedAddress;
  _lines--;
  _currentLine--;
  final int delta;
  if (extended) {
    _extendedLines--;
    delta = 4;
  } else {
    delta = 2;
  }
  final storage = memory.storage;
  while (addr <= _maxAddress) {
    storage.setUint8(addr, storage.getUint8(addr + delta));
    addr++;
  }
  if (extended) {
    storage.setUint8(addr++, 0);
    storage.setUint8(addr++, 0);
  }
  storage.setUint8(addr++, 0);
  storage.setUint8(addr, 0);

  memory.model.needsSave = true;
}