Operation class

Operation performed on a rich-text document.

Constructors

Operation(String key, int? length, Object? data, Map? attributes)
Operation.delete(int length)
Creates operation which deletes length of characters.
factory
Operation.insert(dynamic data, [Map<String, dynamic>? attributes])
Creates operation which inserts text with optional attributes.
factory
Operation.retain(int? length, [Map<String, dynamic>? attributes])
Creates operation which retains length of characters and optionally applies attributes.
factory

Properties

attributes Map<String, dynamic>?
Rich-text attributes set by this operation, can be null.
no setter
data Object?
Payload of "insert" operation, for other types is set to empty string.
final
hashCode int
The hash code for this object.
no setteroverride
isDelete bool
Returns true if this is a delete operation.
no setter
isEmpty bool
Returns true is this operation is empty.
no setter
isInsert bool
Returns true if this is an insert operation.
no setter
isNotEmpty bool
Returns true is this operation is not empty.
no setter
isNotPlain bool
Returns true if this operation sets at least one attribute.
no setter
isPlain bool
Returns true if this operation has no attributes, e.g. is plain text.
no setter
isRetain bool
Returns true if this is a retain operation.
no setter
key String
Key of this operation, can be "insert", "delete" or "retain".
final
length int?
Length of this operation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → dynamic
Returns value of this operation.
no setter

Methods

hasAttribute(String name) bool
Returns true if this operation has attribute specified by name.
hasSameAttributes(Operation other) bool
Returns true if other operation has the same attributes as this one.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Returns JSON-serializable representation of this operation.
toString() String
A string representation of this object.
override

Operators

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

Static Methods

fromJson(Map data, {DataDecoder? dataDecoder}) Operation
Creates new Operation from JSON payload.

Constants

attributesKey → const String
Key of attributes collection.
deleteKey → const String
Key of delete operations.
insertKey → const String
Key of insert operations.
retainKey → const String
Key of retain operations.