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.
- Mixed-in types
- Implementers
- Available extensions
Constructors
- Document()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
nodes
→ List<
DocumentNode> -
Returns all of the content within the document as a list
of DocumentNodes.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
doesSelectedTextContainAttributions(
DocumentSelection selection, Set< Attribution> attributions) → bool -
Available on Document, provided by the DocumentSelectionWithText extension
Returnstrueif all the text within the givenselectioncontains at least some characters with each of the givenattributions. -
doesSelectionContainPosition(
DocumentSelection selection, DocumentPosition position) → bool -
Available on Document, provided by the InspectDocumentSelection extension
Returnstrueif, and only if, the givenpositionsits within the givenselectionin thisDocument. -
getAffinityBetween(
{required DocumentPosition base, required DocumentPosition extent}) → TextAffinity -
Available on Document, provided by the InspectDocumentAffinity extension
Returns the affinity direction implied by the givenbaseandextent. -
getAffinityForSelection(
DocumentSelection selection) → TextAffinity -
Available on Document, provided by the InspectDocumentAffinity extension
-
getNode(
DocumentPosition position) → DocumentNode? -
Returns the DocumentNode at the given
position, ornullif no such node exists in this Document. -
getNodeAfter(
DocumentNode node) → DocumentNode? -
Returns the DocumentNode that appears immediately after the
given
nodein this Document, or null if the givennodeis the last node, or the givennodedoes not exist in this Document. -
getNodeAt(
int index) → DocumentNode? -
Returns the DocumentNode at the given
index, ornullif no such node exists. -
getNodeBefore(
DocumentNode node) → DocumentNode? -
Returns the DocumentNode that appears immediately before the
given
nodein this Document, or null if the givennodeis the first node, or the givennodedoes not exist in this Document. -
getNodeById(
String nodeId) → DocumentNode? -
Returns the DocumentNode with the given
nodeId, ornullif no such node exists. -
getNodeIndex(
DocumentNode node) → int -
Returns the index of the given
node, or-1if thenodedoes not exist within this Document. -
getNodeIndexById(
String nodeId) → int -
Returns the index of the
DocumentNodein thisDocumentthat has the givennodeId, or-1if the node does not exist. -
getNodesInContentOrder(
DocumentSelection selection) → List< DocumentNode> -
Available on Document, provided by the InspectDocumentSelection extension
Returns a list of all theDocumentNodeswithin the givenselection, ordered from upstream to downstream. -
getNodesInside(
DocumentPosition position1, DocumentPosition position2) → List< DocumentNode> -
Returns all DocumentNodes from
position1toposition2, including the nodes atposition1andposition2. -
getRangeBetween(
DocumentPosition position1, DocumentPosition position2) → DocumentRange -
Returns a DocumentRange that ranges from
position1toposition2, includingposition1andposition2. -
hasEquivalentContent(
Document other) → bool -
Returns
trueif the content in theotherdocument is equivalent to the content in this document, ignoring any details that are unrelated to content, such as individual node IDs. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
selectDownstreamPosition(
DocumentPosition docPosition1, DocumentPosition docPosition2) → DocumentPosition -
Available on Document, provided by the InspectDocumentSelection extension
GivendocPosition1anddocPosition2, returns theDocumentPositionthat appears last in the document. -
selectUpstreamPosition(
DocumentPosition docPosition1, DocumentPosition docPosition2) → DocumentPosition -
Available on Document, provided by the InspectDocumentSelection extension
GivendocPosition1anddocPosition2, returns theDocumentPositionthat appears first in the document. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited