void onAck(int ackId)

Source

void onAck(int ackId) {
  if (waitingValues.isEmpty) {
    return;
  }
  bool valueRemoved = false;
  if (!waitingValues.isEmpty && waitingValues.first.waitingAck != ackId) {
    ValueUpdate matchUpdate;
    for (ValueUpdate update in waitingValues) {
      if (update.waitingAck == ackId) {
        matchUpdate = update;
        break;
      }
    }

    if (matchUpdate != null) {
      while (!waitingValues.isEmpty && waitingValues.first != matchUpdate) {
        ValueUpdate removed = waitingValues.removeFirst();
        if (_storage != null) {
          _storage.removeValue(removed);
          valueRemoved = true;
        }
      }
    }
  }

  while (!waitingValues.isEmpty && waitingValues.first.waitingAck == ackId) {
    ValueUpdate removed = waitingValues.removeFirst();
    if (_storage != null) {
      _storage.removeValue(removed);
      valueRemoved = true;
    }
  }

  if (valueRemoved && _storage != null) {
    _storage.valueRemoved(waitingValues);
  }
}