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
- document → Document
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- markNeedsComposing ↔ bool
-
getter/setter pair
-
operations
↔ List<
Operation> -
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.
-
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.
-
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.
-
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
-
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