Line class

Represents a line of data with associated attributes.

This class encapsulates a data object and optional attributes associated with that data. It provides methods to manipulate and manage the data and attributes.

Example usage:

// Creating a new Line instance
Line line = Line(data: 'Example data', attributes: {'color': 'red'});

// Setting new data and merging attributes
line.setData('Updated data');
line.mergeAttributes({'size': '12px'});

print(line.toString()); // Output: Data: Updated data, attributes: {color: red, size: 12px}

Constructors

Line({required List<TextFragment> fragments, String? id})
Line.fromData({required Object data, String? id, Map<String, dynamic>? attributes})
Line.newLine({String? id, @visibleForTesting bool enableTesting = false})

Properties

clone → Line
Creates a copy of the current Line instance.
no setter
deepClone → Line
Creates a deep copy of the current Line instance.
no setter
first → TextFragment?
no setter
fragments → List<TextFragment>
Get a secure copy of the fragments into this Line
no setter
fullHashCode → int
no setter
hashCode → int
The hash code for this object.
no setteroverride
id → String
final
isEmbedFragment → bool
no setter
isEmpty → bool
no setter
isNewLine → bool
no setter
isNotEmpty → bool
no setter
isSealed → bool
no setter
isSingle → bool
no setter
isTextInsert → bool
no setter
last → TextFragment?
no setter
length → int
no setter
rawFragments → List<TextFragment>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textLength → int
no setter
toPlainText → String
no setter

Methods

addFragment(TextFragment fragment) → void
elementAt(int index) → TextFragment
elementAtOrNull(int index) → TextFragment?
equals(covariant Line other, {bool full = false}) → bool
insertAt(int index, TextFragment fragment) → void
insertBefore(int index, TextFragment fragment) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeFragment(TextFragment fragment) → void
removeFragmentAt(int index) → void
removeFragmentWhere({required bool where(TextFragment)}) → void
seal() → void
Set a sealed state, where we can't do any type of modification to this Line instance
toPrettyString({String indent = ' '}) → String
toString() → String
A string representation of this object.
override
unsafeFragments() → List<TextFragment>
Get all direct instances of the fragments into this Line
unseal() → void
Removed the sealed state, to allow modification to this Line instance
updateFragment(int index, TextFragment fragment) → void

Operators

operator ==(covariant Line other) → bool
The equality operator.
override
operator [](int index) → TextFragment
operator []=(int index, TextFragment fragment) → void