Delta class
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".
Constructors
- Delta()
-
Creates new empty Delta.
factory
- Delta.from(Delta other)
-
Creates new Delta from
other
.factory
Properties
- first → Operation
-
Returns the first Operation in this delta.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- isEmpty → bool
-
Returns
true
if this delta is empty.no setter - isNotEmpty → bool
-
Returns
true
if this delta is not empty.no setter - last → Operation
-
Returns the last Operation in this delta.
no setter
- length → int
-
Returns number of operations in this delta.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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 nonexistent method or property is accessed.
inherited
-
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) toend
(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.
override
-
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.
Operators
-
operator ==(
dynamic other) → bool -
The equality operator.
override
-
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.