FragmentOperations class
Utility functions for fragment operations.
Constructors
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
textis 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
countcharacters fromfragmentstarting fromoffset. Returns false if the range is invalid. Optimised edge cases avoid temp substring allocations. -
insertTextInFragment(
Fragment fragment, int offset, String text) → bool -
Inserts
textinfragmentatoffset. Returns false if offset is out of range. Optimised edge cases (prepend / append) avoid temp substring allocations. -
mergeFragments(
Fragment fragment, Fragment next) → void -
Merges
nextintofragment(concatenates the text, thennextmust be removed from the container by the caller). -
splitFragment(
Fragment fragment, int offset) → ({Fragment left, Fragment right}) -
Splits
fragmentatoffset: returns (left, right). The original fragment is mutated (becomes the left part). The right part is a new Fragment with the same style (cloneFragment).