SpannedString class

Rich text represented with a String and a SpanList.

Annotations

Constructors

SpannedString(String text, [SpanList? spans])
Create a spanned string.
SpannedString.chars(Characters text, SpanList spans)
Create a spanned string.

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Length of this spanned string. This is equal to the length of text.
final
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
spans SpanList
Formatting of this spanned string.
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
text Characters
Plain text of this spanned string.
final

Methods

applyDiff(StringDiff diff) SpannedString
Apply diff to this spanned string and return the result.
buildTextSpan({required BuildContext context, TextStyle? style, AttributeGestureMapper? gestureMapper}) TextSpan
Apply the attributes to text and return the resulting TextSpan.
collapse({int? start, int? end}) SpannedString
Delete a part of this spanned text.
concat(SpannedString other) SpannedString
Concatenate another spanned string with this one and return the result.
copyWith({Characters? text, SpanList? spans}) SpannedString
Creates a copy of this spanned string, but with the given fields replaced with the new values.
insert(int index, Characters inserted) SpannedString
Insert text into this spanned text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

empty → const SpannedString
An empty spanned string.