Delta class Null safety

Delta represents a document or a modification of a document as a sequence of insert, delete and retain operations.

Delta consisting of only "insert" operations is usually referred to as "document delta". When delta includes also "retain" or "delete" operations it is a "change delta".


Creates new empty Delta.
Delta.from(Delta other)
Creates new Delta from other.


first Operation
Returns the first Operation in this delta.
hashCode int
The hash code for this object.
isEmpty bool
Returns true if this delta is empty.
isNotEmpty bool
Returns true if this delta is not empty.
last Operation
Returns the last Operation in this delta.
length int
Returns number of operations in this delta.
runtimeType Type
A representation of the runtime type of the object.


compose(Delta other) Delta
Composes this delta with other and returns new Delta.
concat(Delta other) Delta
Concatenates other with this delta and returns the result.
delete(int count) → void
Delete count characters from current position.
elementAt(int index) Operation
Returns Operation at specified index in this delta.
insert(String text, [Map<String, dynamic>? attributes]) → void
Insert text at current position.
invert(Delta base) Delta
Inverts this delta against base.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
push(Operation operation) → void
Pushes new operation into this delta.
retain(int count, [Map<String, dynamic>? attributes]) → void
Retain count of characters from current position.
slice(int start, [int? end]) Delta
Returns slice of this delta from start index (inclusive) to end (exclusive).
toJson() List
Returns JSON-serializable version of this delta.
toList() List<Operation>
Returns list of operations in this delta.
toString() String
A string representation of this object.
transform(Delta other, bool priority) Delta
Transforms other delta against operations in this delta.
transformPosition(int index, {bool force = true}) int
Transforms index against this delta.
trim() → void
Removes trailing retain operation with empty attributes, if present.


operator ==(dynamic other) bool
The equality operator.
operator [](int index) Operation
Returns Operation at specified index in this delta.

Static Methods

composeAttributes(Map<String, dynamic>? a, Map<String, dynamic>? b, {bool keepNull = false}) Map<String, dynamic>?
Composes two attribute sets.
fromJson(List data) Delta
Creates Delta from de-serialized JSON representation.
invertAttributes(Map<String, dynamic>? attr, Map<String, dynamic>? base) Map<String, dynamic>
get anti-attr result base on base
transformAttributes(Map<String, dynamic>? a, Map<String, dynamic>? b, bool priority) Map<String, dynamic>?
Transforms two attribute sets.