Controls the granularity at which a document is split into independently timestamped CRDT records, and therefore how concurrent edits to the same document merge.
A Collection<T> converts each document to a JSON map (via its Codec) and
hands it to a MergeStrategy. fields decomposes it into a set of
FieldSpec entries; each entry becomes its own CRDT record with its own
Hybrid Logical Clock, so concurrent edits to different entries both survive
a merge. How concurrent edits to the same entry resolve depends on the
entry's CrdtType (last-write-wins for LwwRegister, the default).
Built-in strategies:
ObjectMergeStrategy— the whole document is a single record (whole-document last-write-wins). The default.ShallowMergeStrategy— each top-level field is its own record; nested objects and lists are atomic.DeepMergeStrategy— nested maps are flattened recursively; lists and scalars are leaves.SchemaMergeStrategy— a per-field strategy that also assigns a CrdtType to named field paths; unlisted fields stay LwwRegister.
Implement this interface to define a custom decomposition.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
fields(
Map< String, dynamic> document) → Iterable<FieldSpec> -
Decomposes
documentinto the CRDT records it should be stored as. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
typeAt(
String path) → CrdtType -
The CrdtType this strategy assigns to the field at
path. -
unflatten(
Iterable< FieldValue> rows) → Map<String, dynamic> -
Rebuilds the document map from its live field
rows(path → value), the inverse of fields.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited