FragmentOperations class

Utility functions for fragment operations.

Constructors

FragmentOperations()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

cloneFragment(Fragment source, {String? text}) Fragment
Creates a new fragment with the same styles as the source fragment. If text is provided, uses that text; otherwise uses the source fragment's text.
collectLeafFragments(FNode node) List<Fragment>
Recursively collects all leaf fragments in order. A leaf fragment is a Fragment that is not an InlineContainerNode.
createFragmentWithPendingStyles(FluentDocument document, String text) Fragment
Creates a new fragment with styles from the document's pending styles. Used when inserting new text at the cursor position.
deleteTextInFragment(Fragment fragment, int offset, {int count = 1}) bool
Deletes count characters from fragment starting from offset. Returns false if the range is invalid. Optimised edge cases avoid temp substring allocations.
insertTextInFragment(Fragment fragment, int offset, String text) bool
Inserts text in fragment at offset. Returns false if offset is out of range. Optimised edge cases (prepend / append) avoid temp substring allocations.
mergeFragments(Fragment fragment, Fragment next) → void
Merges next into fragment (concatenates the text, then next must be removed from the container by the caller).
splitFragment(Fragment fragment, int offset) → ({Fragment left, Fragment right})
Splits fragment at offset: returns (left, right). The original fragment is mutated (becomes the left part). The right part is a new Fragment with the same style (cloneFragment).