Transaction class
A Transaction has a list of Operation objects that will be applied to the editor.
There will be several ways to consume the transaction:
- Apply to the state to update the UI.
- Send to the backend to store and do operation transforming.
- Available extensions
Constructors
- Transaction({required Document document})
Properties
- afterSelection ↔ Selection?
-
The selection to be applied.
getter/setter pair
- beforeSelection ↔ Selection?
-
The before selection is to be recovered if needed.
getter/setter pair
- customSelectionType ↔ SelectionType?
-
The custom selection type is to be applied.
getter/setter pair
- document → Document
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- markNeedsComposing ↔ bool
-
getter/setter pair
-
operations
↔ List<
Operation> -
getter/setter pair
- reason ↔ SelectionUpdateReason?
-
The custom selection reason is to be applied.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectionExtraInfo ↔ Map?
-
getter/setter pair
Methods
-
add(
Operation operation, {bool transform = true}) → void - Adds an operation to the transaction. This method will merge operations if they are both TextEdits.
-
addDeltaToComposeMap(
Node node, Delta delta) → void -
Available on Transaction, provided by the TextTransaction extension
-
compose(
) → void -
Available on Transaction, provided by the TextTransaction extension
Compose the delta in the compose map. -
deleteNode(
Node node) → void - Deletes the Node in the document.
-
deleteNodes(
Iterable< Node> nodes) → void - Deletes the Nodes in the document.
-
deleteNodesAtPath(
Path path, [int length = 1]) → void - Deletes the Nodes at the given Path.
-
deleteText(
Node node, int index, int length) → void -
Available on Transaction, provided by the TextTransaction extension
Deletes thelengthcharacters at the givenindex. -
formatText(
Node node, int index, int length, Attributes attributes) → void -
Available on Transaction, provided by the TextTransaction extension
-
insertNode(
Path path, Node node, {bool deepCopy = true}) → void - Inserts the Node at the given Path.
-
insertNodes(
Path path, Iterable< Node> nodes, {bool deepCopy = true}) → void - Inserts a sequence of Nodes at the given Path.
-
insertText(
Node node, int index, String text, {Attributes? attributes, Attributes? toggledAttributes, bool sliceAttributes = true}) → void -
Available on Transaction, provided by the TextTransaction extension
Inserts thetextat the givenindex. -
insertTextDelta(
Node node, int index, Delta insertedDelta) → void -
Available on Transaction, provided by the TextTransaction extension
-
mergeText(
Node left, Node right, {int? leftOffset, int rightOffset = 0}) → void -
Available on Transaction, provided by the TextTransaction extension
-
moveNode(
Path path, Node node) → void - Moves a Node to the provided Path
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceText(
Node node, int index, int length, String text, {Attributes? attributes}) → void -
Available on Transaction, provided by the TextTransaction extension
replace the text at the givenindexwith thetext. -
replaceTexts(
List< Node> nodes, Selection selection, List<String> texts) → void -
Available on Transaction, provided by the TextTransaction extension
-
replaceTextsWithEqualNodes(
List< Node> nodes, Selection selection, List<String> texts) → void -
Available on Transaction, provided by the TextTransaction extension
-
replaceTextsWithLessNodes(
List< Node> nodes, Selection selection, List<String> texts) → void -
Available on Transaction, provided by the TextTransaction extension
-
replaceTextsWithMoreNodes(
List< Node> nodes, Selection selection, List<String> texts) → void -
Available on Transaction, provided by the TextTransaction extension
-
toJson(
) → Map< String, dynamic> - Returns the JSON representation of the transaction.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateNode(
Node node, Attributes attributes) → void - Updates the attributes of the Node.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited