waitForSynchronization method

Future<void> waitForSynchronization([
  1. CancellationToken? cancellationToken
])

Waits for the server to acknowledge the subscription set and return the matching objects.

If the state of the subscription set is SubscriptionSetState.complete the returned Future will complete immediately. If the state is SubscriptionSetState.error, the returned future will throw an error. An optional cancellationToken can be used to cancel the wait operation.

Implementation

Future<void> waitForSynchronization([CancellationToken? cancellationToken]) async {
  final result = await _waitForStateChange(SubscriptionSetState.complete, cancellationToken);
  if (result == SubscriptionSetState.error) {
    throw error!;
  }
}