Document class

The rich text document

Constructors

Document()
Creates new empty document.
Document.fromDelta(Delta delta)
Creates new document from provided delta.
Document.fromJson(List data)
Creates new document from provided JSON data.

Properties

changes Stream<DocChange>
Stream of DocChanges applied to this document.
no setter
documentChangeObserver StreamController<DocChange>
final
hashCode int
The hash code for this object.
no setterinherited
hasRedo bool
no setter
hasUndo bool
no setter
history → History
final
length int
Length of this document.
no setter
root Root
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → void
collectAllIndividualStyleAndEmbed(int index, int len) List<OffsetValue>
Returns all styles and Embed for each node within selection
collectAllStyles(int index, int len) List<Style>
Returns all styles for any character within the specified text range.
collectAllStylesWithOffset(int index, int len) List<OffsetValue<Style>>
Returns all styles for any character within the specified text range.
collectStyle(int index, int len) Style
Only attributes applied to all characters within this range are included in the result.
compose(Delta delta, ChangeSource changeSource) → void
Composes change Delta into this document.
delete(int index, int len) Delta
Deletes length of characters from this document starting at index.
format(int index, int len, Attribute? attribute) Delta
Formats segment of this document with specified attribute.
getPlainText(int index, int len) String
Returns plain text within the specified text range.
insert(int index, Object? data, {int replaceLength = 0}) Delta
Inserts data in this document at specified index.
isEmpty() bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryChild(int offset) → ChildQuery
Returns Line located at specified character offset.
querySegmentLeafNode(int offset) → SegmentLeafNode
Given offset, find its leaf node in document
redo() → HistoryChanged
replace(int index, int len, Object? data) Delta
Replaces length of characters starting at index with data.
Search given substring in the whole document Supports caseSensitive and wholeWord options Returns correspondent offsets
setCustomRules(List<Rule> customRules) → void
toDelta() Delta
Returns contents of this document as Delta.
toPlainText([Iterable<EmbedBuilder>? embedBuilders, EmbedBuilder? unknownEmbedBuilder]) String
Returns plain text representation of this document.
toString() String
A string representation of this object.
inherited
undo() → HistoryChanged

Operators

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

Static Methods

fromHtml(String html) Document
Convert the HTML Raw string to Document