IncrementalMarkdownParser class
Parses Markdown that grows at the end, such as a streamed AI reply.
Finished blocks are parsed once and kept in frozenBlocks; only the
last, open block is parsed again on every update, after its unfinished
syntax is closed by healIncompleteMarkdown. Once complete, the blocks
match a parse of the whole text.
Constructors
- IncrementalMarkdownParser({MarkdownSyntax syntax = const MarkdownSyntax()})
-
Creates a parser for the extensions in
syntax.
Properties
-
frozenBlocks
→ List<
FrozenBlock> -
The finished blocks, in order.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isComplete → bool
-
Whether the last update was the whole text.
no setter
-
openNodes
→ List<
Node> -
The parsed open block, with its unfinished syntax closed.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- syntax → MarkdownSyntax
-
The Markdown extensions that are recognized.
final
- text → String
-
The text of the last update.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void - Forgets everything parsed so far.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
String text, {required bool complete}) → bool -
Parses
text, reusing the blocks of the previous text whentextstarts with it. Returns whether anything changed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited