mergeFromFirestore<T> function

T? mergeFromFirestore<T>(
  1. T? existing,
  2. T? incoming,
  3. NimbostratusFromFirestore<T>? fromFirestore
)

A merge function for specifying how a server response from Firestore should be merged into the cache given the existing and incoming data.

Implementation

T? mergeFromFirestore<T>(
  T? existing,
  T? incoming,
  NimbostratusFromFirestore<T>? fromFirestore,
) {
  if (existing == null || fromFirestore == null) {
    return incoming;
  }

  return fromFirestore(
    existing,
    incoming,
  );
}