Document class abstract

A read-only document with styled text and multimedia elements.

A Document is comprised of a list of DocumentNodes, which describe the type and substance of a piece of content within the document. For example, a ParagraphNode holds a single paragraph of text within the document.

New types of content can be added by subclassing DocumentNode.

To represent a specific location within a Document, see DocumentPosition.

A Document has no opinion on the visual presentation of its content.

To edit the content of a document, see DocumentEditor.

Implemented types
Implementers
Available extensions

Constructors

Document()

Properties

first DocumentNode
The first element.
no setterinherited
firstOrNull DocumentNode?
Returns the first DocumentNode in this Document, or null if this Document is empty.
no setter
hashCode int
The hash code for this object.
no setterinherited
isEmpty bool
Returns true if this Document has zero nodes, or false if it has `1+ nodes.
no setteroverride
isNotEmpty bool
Whether this collection has at least one element.
no setterinherited
iterator Iterator<DocumentNode>
A new Iterator that allows iterating the elements of this Iterable.
no setterinherited
last DocumentNode
The last element.
no setterinherited
lastOrNull DocumentNode?
Returns the last DocumentNode in this Document, or null if this Document is empty.
no setter
length int
The number of elements in this Iterable.
no setterinherited
nodeCount int
The number of DocumentNodes in this Document.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
single DocumentNode
Checks that this iterable has only one element, and returns that element.
no setterinherited

Methods

addListener(DocumentChangeListener listener) → void
any(bool test(DocumentNode element)) bool
Checks whether any element of this iterable satisfies test.
inherited
cast<R>() Iterable<R>
A view of this iterable as an iterable of R instances.
inherited
contains(Object? element) bool
Whether the collection contains an element equal to element.
inherited
elementAt(int index) DocumentNode
Returns the indexth element.
inherited
every(bool test(DocumentNode element)) bool
Checks whether every element of this iterable satisfies test.
inherited
expand<T>(Iterable<T> toElements(DocumentNode element)) Iterable<T>
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere(bool test(DocumentNode element), {DocumentNode orElse()?}) DocumentNode
The first element that satisfies the given predicate test.
inherited
fold<T>(T initialValue, T combine(T previousValue, DocumentNode element)) → T
Reduces a collection to a single value by iteratively combining each element of the collection with an existing value
inherited
followedBy(Iterable<DocumentNode> other) Iterable<DocumentNode>
Creates the lazy concatenation of this iterable and other.
inherited
forEach(void action(DocumentNode element)) → void
Invokes action on each element of this iterable in iteration order.
inherited
getNode(DocumentPosition position) DocumentNode?
Returns the DocumentNode at the given position, or null if no such node exists in this Document.
getNodeAfter(DocumentNode node) DocumentNode?
Returns the DocumentNode that appears immediately after the given node in this Document, or null if the given node is the last node, or the given node does not exist in this Document.
getNodeAt(int index) DocumentNode?
Returns the DocumentNode at the given index, or null if no such node exists.
getNodeBefore(DocumentNode node) DocumentNode?
Returns the DocumentNode that appears immediately before the given node in this Document, or null if the given node is the first node, or the given node does not exist in this Document.
getNodeById(String nodeId) DocumentNode?
Returns the DocumentNode with the given nodeId, or null if no such node exists.
getNodeIndex(DocumentNode node) int
Returns the index of the given node, or -1 if the node does not exist within this Document.
getNodeIndexById(String nodeId) int
Returns the index of the DocumentNode in this Document that has the given nodeId, or -1 if the node does not exist.
getNodesInside(DocumentPosition position1, DocumentPosition position2) List<DocumentNode>
Returns all DocumentNodes from position1 to position2, including the nodes at position1 and position2.
hasEquivalentContent(Document other) bool
Returns true if the content in the other document is equivalent to the content in this document, ignoring any details that are unrelated to content, such as individual node IDs.
join([String separator = ""]) String
Converts each element to a String and concatenates the strings.
inherited
lastWhere(bool test(DocumentNode element), {DocumentNode orElse()?}) DocumentNode
The last element that satisfies the given predicate test.
inherited
map<T>(T toElement(DocumentNode e)) Iterable<T>
The current elements of this iterable modified by toElement.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce(DocumentNode combine(DocumentNode value, DocumentNode element)) DocumentNode
Reduces a collection to a single value by iteratively combining elements of the collection using the provided function.
inherited
removeListener(DocumentChangeListener listener) → void
singleWhere(bool test(DocumentNode element), {DocumentNode orElse()?}) DocumentNode
The single element that satisfies test.
inherited
skip(int count) Iterable<DocumentNode>
Creates an Iterable that provides all but the first count elements.
inherited
skipWhile(bool test(DocumentNode value)) Iterable<DocumentNode>
Creates an Iterable that skips leading elements while test is satisfied.
inherited
take(int count) Iterable<DocumentNode>
Creates a lazy iterable of the count first elements of this iterable.
inherited
takeWhile(bool test(DocumentNode value)) Iterable<DocumentNode>
Creates a lazy iterable of the leading elements satisfying test.
inherited
toList({bool growable = true}) List<DocumentNode>
Creates a List containing the elements of this Iterable.
inherited
toSet() Set<DocumentNode>
Creates a Set containing the same elements as this iterable.
inherited
toString() String
A string representation of this object.
inherited
where(bool test(DocumentNode element)) Iterable<DocumentNode>
Creates a new lazy Iterable with all elements that satisfy the predicate test.
inherited
whereType<T>() Iterable<T>
Creates a new lazy Iterable with all elements that have type T.
inherited

Operators

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