add method

  1. @override
void add(
  1. NimbostratusDocumentSnapshot<T>? snap
)
override

Updates the current value of the StateBloc to the provided value.

Implementation

@override
// ignore: avoid_renaming_method_parameters
void add(snap) {
  // Optimistic snapshots link their previous and next snapshots in order to support
  // rollback of optimistic updates.
  if (snap?.isOptimistic ?? false) {
    final currentSnap = value;

    if (currentSnap?.isOptimistic ?? false) {
      currentSnap!.next = snap;
    }
    snap!.prev = value;
  }
  super.add(snap);
}