start method

void start({
  1. FutureOr<void> onSnapshot(
    1. ServerSnapshot snapshot
    )?,
})

Starts watching the tracked documents. Calling it again does nothing.

onSnapshot runs on each snapshot as soon as it is taken. The stream gets the snapshot once what onSnapshot returns completes, and never when it fails: a registry that stores snapshots waits there for the storage.

Implementation

void start({FutureOr<void> Function(ServerSnapshot snapshot)? onSnapshot}) {
  if (_started) {
    return;
  }
  _started = true;
  _onSnapshot = onSnapshot;
  _documents.forEach(_subscribe);
}