Conflict Resolution
Choose how Abrova Sync resolves write conflicts when offline edits collide with the server — Server Wins, Client Wins, Merge, or Manual callback.
When the same document is edited offline on a device and on another client (or on the server) before the device reconnects, AbrovaSync needs a policy for which version wins. Pick the strategy that matches your data model.
Conflict Resolution Strategies#
serverWins
Server version always wins. Best for shared data where the server is the source of truth.
clientWins
Client version always wins. Best for personal data or when offline edits should persist.
merge
Automatically merge non-conflicting fields. Best for documents with independent fields.
manual
Your app decides via a conflictResolver callback (Android and iOS only). Best when you need custom merge logic.
Choosing a strategy#
| Use case | Recommended strategy |
|---|---|
| Shared documents (e.g. team workspace) | serverWins |
| Personal data (e.g. user preferences, notes) | clientWins |
| Counters or independent fields on one doc | merge |
| Domain-specific (e.g. shopping cart line-items) | manual |
Configuring the strategy#
The conflict strategy is set once at initialization — see Offline Persistence for the full per-platform setup. The relevant config field is:
- Flutter —
conflictStrategy: ConflictStrategy.serverWins - React Native —
conflictStrategy: 'serverWins' - Web —
conflictStrategy: 'serverWins'(not supported on Web: see below) - Android —
.conflictStrategy(ConflictStrategy.SERVER_WINS) - iOS —
.conflictStrategy(.serverWins)
Swap serverWins for clientWins, merge, or manual as needed.
The strategies are applied by the native Android and iOS SDKs, which Flutter and React Native wrap. manual needs a resolver, which only Android (.conflictResolver { conflict -> ... }) and iOS (.conflictResolver(...)) let you set; without one — including on Flutter and React Native — it falls back to serverWins. conflictStrategy is not supported on Web: writes queued offline are replayed as they are when the connection returns, so the last write wins.