serverWins<T> function

ConflictResolver<T> serverWins<T>()

A ConflictResolver that keeps the server's value: the local optimistic write is dropped and the cache is refreshed with ConflictResolver.resolve's serverValue.

The safest default when the server is authoritative (e.g. inventory counts, server-generated fields).

final cache = Syncache<Cart>(
  store: store,
  conflictResolver: serverWins<Cart>(),
);

Implementation

ConflictResolver<T> serverWins<T>() => _ServerWins<T>();