CommentProvider class abstract
Abstract interface for a comment system plugin.
The FluentDocument holds an optional instance. When set, the editor will display comment highlights, a sidebar with comment cards, and allow adding / resolving / replying to comments.
Constructors
Properties
-
commentsChanged
→ Stream<
void> -
Stream that emits whenever comments change (add, reply, resolve, delete,
or mutation shift).
no setter
- currentAuthor ↔ String
-
Default author name used when adding new comments or replies.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedCommentId ↔ String?
-
Returns the currently selected comment id (the one whose card is
active in the sidebar). Null when none is selected.
getter/setter pair
- showResolved ↔ bool
-
Whether resolved comments should be visible.
getter/setter pair
Methods
-
addComment(
String nodeId, int startOffset, int endOffset, String author, String text) → bool -
Adds a new comment anchored to
nodeIdfromstartOffsettoendOffset. Returns true if the comment was added, false if it overlaps an existing comment on the same node (in which case the caller should show a warning). -
addReply(
String commentId, String author, String text) → void - Adds a reply to an existing comment.
-
commentsForNode(
String nodeId) → List< Map< String, dynamic> > -
Returns the list of active (non-orphan) comments for
nodeId. Each item is a map with the keys expected by the render layer: 'id' -> String 'startOffset' -> int 'endOffset' -> int 'resolved' -> bool 'orphan' -> bool -
deleteComment(
String commentId) → void - Permanently deletes a comment.
-
dispose(
) → void - Disposes the provider.
-
exportComments(
) → List< Map< String, dynamic> > - Exports all comments as serialisable maps for use by exporters. Each map contains: 'id', 'nodeId', 'startOffset', 'endOffset', 'authorName', 'text', 'createdAt', 'replies' -> List
-
importComments(
List< Map< data) → voidString, dynamic> > - Imports comments from a list of serialised maps (the inverse of exportComments). Replaces any existing comments.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDocumentMutation(
String nodeId, int fromOffset, int delta) → void -
Notifies the provider that the text of
nodeIdwas mutated.fromOffsetis the point where characters were inserted or deleted.deltais positive for insertions, negative for deletions. -
resolveComment(
String commentId) → void - Marks a comment as resolved.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited