MapPatchDelta<K, V> class final

An ordered sequence of MapPatchOp steps — the key-keyed counterpart of ListPatchDelta.

Same algebra and the same laws: diff is minimal (one put per added or changed key, one remove per dropped key, none for an unchanged map), apply never mutates, compose concatenates and invert round-trips.

Implemented types

Constructors

MapPatchDelta(List<MapPatchOp<K, V>> ops)
Creates a delta over ops, applied in order.
const
MapPatchDelta.empty()
The empty delta: no operation, no change.

Properties

hashCode → int
The hash code for this object.
no setteroverride
isEmpty → bool
Whether this patch carries no change at all.
no setteroverride
isNotEmpty → bool
Whether this patch carries at least one change.
no setteroverride
ops → List<MapPatchOp<K, V>>
The steps this delta applies, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(Map<K, V> target) → Map<K, V>
Returns target with this patch applied.
override
applyTo(Map<K, V> entity) → Map<K, V>
The legacy Patch entry point: same behaviour as apply.
override
compose(covariant MapPatchDelta<K, V> next) → MapPatchDelta<K, V>
Returns the patch that applies this patch first and then next.
override
invert(Map<K, V> before) → MapPatchDelta<K, V>
The delta that restores before — a single replaceAll, for the same reason ListPatchDelta.invert is: positional history is not carried.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override
toWire() → Map<String, Object?>
The wire form of this patch: the field changes it carries, keyed by the field name they belong to.
override
toWireSteps() → List<Object?>
The field-level wire form: a bare list of steps, not {'ops': [...]}.

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

diff<K, V>(Map<K, V> previous, Map<K, V> next) → MapPatchDelta<K, V>
The smallest delta that turns previous into next.