Operation class

Operation performed on a rich-text document.

Constructors

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.
read-only
data → dynamic
Payload of "insert" operation, for other types is set to empty string.
final
hashCode int
The hash code for this object. [...]
read-only, override
isDelete bool
Returns true if this is a delete operation.
read-only
isEmpty bool
Returns true is this operation is empty. [...]
read-only
isInsert bool
Returns true if this is an insert operation.
read-only
isNotEmpty bool
Returns true is this operation is not empty.
read-only
isNotPlain bool
Returns true if this operation sets at least one attribute.
read-only
isPlain bool
Returns true if this operation has no attributes, e.g. is plain text.
read-only
isRetain bool
Returns true if this is a retain operation.
read-only
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.
read-only, inherited
value → dynamic
Returns value of this operation. [...]
read-only

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 non-existent 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 ==(dynamic other) bool
The equality operator. [...]
override

Static Methods

fromJson(dynamic data) Operation
Creates new Operation from JSON payload.

Constants

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