SpanList class
Manages AttributeSpans apart from the text to which they are to be applied.
Call shift when text is inserted and collapse when text is deleted.
Add attribute spans with merge and remove them with remove.
Note that SpanList is immutable. Any mutation operation will return a new SpanList.
- Annotations
Constructors
-
SpanList(Iterable<
AttributeSpan> ? spans) -
Create a SpanList.
factory
-
SpanList.fromSegments(Iterable<
AttributeSegment> segments) -
Create a SpanList from segments.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
iter
→ Iterable<
AttributeSpan> -
Get an iterator for the spans in this list.
no setter
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited
Methods
-
collapse(
Range range) → SpanList -
Collapse span with a deletion at
range
. -
getSegments(
Characters t) → Iterable< AttributeSegment> - Get an iterator of the segments for this list.
-
getSpans(
TextAttribute attribute) → Iterable< AttributeSpan> -
Get the spans with the specified
attribute
. -
getSpansIn(
Range range, TextAttribute attribute) → Iterable< AttributeSpan> -
Get the spans with the specified
attribute
inrange
. -
getTypedSpans<
T extends TextAttribute> () → Iterable< AttributeSpan> -
Get the spans with attributes of type
T
. -
getTypedSpansIn<
T extends TextAttribute> (Range range) → Iterable< AttributeSpan> -
Get the spans with attributes of type
T
inrange
. -
isApplied(
TextAttribute attribute, Range range) → bool -
Returns true if
attribute
is applied to the full range of text. -
isTypeApplied<
T extends TextAttribute> (Range range) → bool -
Returns true if an attribute of type
T
is applied to the full range of text. -
merge(
AttributeSpan span) → SpanList - Add a span. Merges touching spans with the same attribute or type.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
AttributeSpan span) → SpanList -
Remove
span
. -
removeAll(
TextAttribute attribute) → SpanList - Remove all spans with the given attribute.
-
removeFrom(
Range range, TextAttribute attribute) → SpanList -
Remove all spans with the given attribute from
range
. -
removeType<
T extends TextAttribute> () → SpanList -
Remove all spans of type
T
. -
removeTypeFrom<
T extends TextAttribute> (Range range) → SpanList -
Remove all spans with attributes of type
T
. -
shift(
int index, int length) → SpanList -
Shift spans with an insertion at
index
with the givenlength
. -
toString(
) → String - A string representation of this object.
-
willApply(
TextAttribute attribute, int index) → bool -
Returns true if an insertion at
index
would applyattribute
to it due to a span's ExpandRule. -
willApplyType<
T extends TextAttribute> (TextAttribute attribute, int index) → bool -
Returns true if an insertion at
index
would apply an attribute of typeT
to it due to a span's ExpandRule.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited