enqueuePut method

Future<void> enqueuePut(
  1. String blockId,
  2. Uint8List data
)

Implementation

Future<void> enqueuePut(String blockId, Uint8List data) async {
  final existing = _pendingQueue.indexWhere(
    (op) => op.blockId == blockId && op.type == 'put',
  );
  if (existing >= 0) {
    _pendingQueue[existing] = _PendingOp('put', blockId, data);
  } else {
    _pendingQueue.removeWhere(
      (op) => op.blockId == blockId && op.type == 'delete',
    );
    _pendingQueue.add(_PendingOp('put', blockId, data));
  }
  _schedulePersist();
}