Delta class
Deltas are a simple, yet expressive format that can be used to describe contents and changes. The format is JSON based, and is human readable, yet easily parsible by machines. Deltas can describe any rich text document, includes all text and formatting information, without the ambiguity and complexity of HTML.
Basically borrowed from: https://github.com/quilljs/delta
- Inheritance
-
- Object
- Iterable<
TextOperation> - Delta
- Available Extensions
Constructors
-
Delta({List<
TextOperation> ? operations}) - Delta.fromJson(List list)
-
factory
Properties
- first → TextOperation
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setteroverride
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
TextOperation> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setteroverride - last → TextOperation
-
The last element.
no setterinherited
- length → int
-
The length of the string of the Delta.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → TextOperation
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
add(
TextOperation textOperation) → void -
addAll(
Iterable< TextOperation> textOperations) → void -
any(
bool test(TextOperation element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
chop(
) → void -
compose(
Delta other) → Delta - Returns a Delta that is equivalent to applying the operations of own Delta, followed by another Delta.
-
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
delete(
int length) → void -
Delete operations have a Number
delete
key defined representing the number of characters to delete. -
diff(
Delta other) → Delta -
elementAt(
int index) → TextOperation -
Returns the
index
th element.inherited -
every(
bool test(TextOperation element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> toElements(TextOperation element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(TextOperation element), {TextOperation orElse()?}) → TextOperation -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, TextOperation element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< TextOperation> other) → Iterable<TextOperation> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(TextOperation element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
insert(
String text, {Attributes? attributes}) → void -
Insert operations have an
insert
key defined. A String value represents inserting text. -
invert(
Delta base) → Delta - Returned an inverted delta that has the opposite effect of against a base document delta.
-
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(TextOperation element), {TextOperation orElse()?}) → TextOperation -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(TextOperation e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
nextRunePosition(
int pos) → int - This method will return the position of the next rune.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
prevRunePosition(
int pos) → int - This method will return the position of the previous rune.
-
reduce(
TextOperation combine(TextOperation value, TextOperation element)) → TextOperation -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
retain(
int length, {Attributes? attributes}) → void -
Retain operations have a Number
retain
key defined representing the number of characters to keep (other libraries might use the name keep or skip). An optionalattributes
key can be defined with an Object to describe formatting changes to the character range. A value ofnull
in theattributes
Object represents removal of that key. -
singleWhere(
bool test(TextOperation element), {TextOperation orElse()?}) → TextOperation -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< TextOperation> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(TextOperation value)) → Iterable< TextOperation> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
slice(
int start, [int? end]) → Delta - The slice() method does not change the original string. The start and end parameters specifies the part of the string to extract. The end position is optional.
-
sliceAttributes(
int index) → Attributes? -
take(
int count) → Iterable< TextOperation> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(TextOperation value)) → Iterable< TextOperation> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toJson(
) → List -
toList(
{bool growable = true}) → List< TextOperation> -
Creates a List containing the elements of this Iterable.
inherited
-
toPlainText(
) → String -
toSet(
) → Set< TextOperation> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
trim(
) → void -
where(
bool test(TextOperation element)) → Iterable< TextOperation> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator +(
Delta other) → Delta - This method joins two Delta together.
-
operator ==(
Object other) → bool -
The equality operator.
override