sendOperations method

  1. @override
Future<void> sendOperations(
  1. List<Operation> operations
)
override

Sends multiple operations to the server/peers efficiently.

Implementation

@override
Future<void> sendOperations(List<Operation> operations) async {
  if (_disposed) throw StateError('Offline client is disposed');
  const transientOps = {'CURSOR_MOVE', 'GHOST_UPDATE', 'PRESENCE_UPDATE'};
  final durable = <Operation>[];
  for (final operation in operations) {
    if (transientOps.contains(operation.type)) {
      final inner = _innerClient;
      if (inner != null && _isConnected) await inner.sendOperation(operation);
    } else {
      durable.add(operation);
    }
  }
  if (durable.isEmpty) return;
  await ready;
  await persistOperations(durable);
  await _updatePendingCount();
  _scheduleFlush();
}