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
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
Returnstrue
if all the text within the givenselection
contains at least some characters with each of the givenattributions
. -
doesSelectionContainPosition(
DocumentSelection selection, DocumentPosition position) → bool -
Available on Document, provided by the InspectDocumentSelection extension
Returnstrue
if, and only if, the givenposition
sits within the givenselection
in thisDocument
. -
getAffinityBetween(
{required DocumentPosition base, required DocumentPosition extent}) → TextAffinity -
Available on Document, provided by the InspectDocumentAffinity extension
Returns the affinity direction implied by the givenbase
andextent
. -
getAffinityForSelection(
DocumentSelection selection) → TextAffinity -
Available on Document, provided by the InspectDocumentAffinity extension
-
getNode(
DocumentPosition position) → DocumentNode? -
Returns the DocumentNode at the given
position
, ornull
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 givennode
is the last node, or the givennode
does not exist in this Document. -
getNodeAt(
int index) → DocumentNode? -
Returns the DocumentNode at the given
index
, ornull
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 givennode
is the first node, or the givennode
does not exist in this Document. -
getNodeById(
String nodeId) → DocumentNode? -
Returns the DocumentNode with the given
nodeId
, ornull
if no such node exists. -
getNodeIndex(
DocumentNode node) → int -
Returns the index of the given
node
, or-1
if thenode
does not exist within this Document. -
getNodeIndexById(
String nodeId) → int -
Returns the index of the
DocumentNode
in thisDocument
that has the givennodeId
, or-1
if the node does not exist. -
getNodesInContentOrder(
DocumentSelection selection) → List< DocumentNode> -
Available on Document, provided by the InspectDocumentSelection extension
Returns a list of all theDocumentNodes
within the givenselection
, ordered from upstream to downstream. -
getNodesInside(
DocumentPosition position1, DocumentPosition position2) → List< DocumentNode> -
Returns all DocumentNodes from
position1
toposition2
, including the nodes atposition1
andposition2
. -
getRangeBetween(
DocumentPosition position1, DocumentPosition position2) → DocumentRange -
Returns a DocumentRange that ranges from
position1
toposition2
, includingposition1
andposition2
. -
hasEquivalentContent(
Document other) → bool -
Returns
true
if the content in theother
document 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
GivendocPosition1
anddocPosition2
, returns theDocumentPosition
that appears last in the document. -
selectUpstreamPosition(
DocumentPosition docPosition1, DocumentPosition docPosition2) → DocumentPosition -
Available on Document, provided by the InspectDocumentSelection extension
GivendocPosition1
anddocPosition2
, returns theDocumentPosition
that appears first in the document. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited