ParseDecoderSink<R> class final

A StringConversionSinkBase that decodes chunks of String into batches of R contiguously.

Note that parsers succeeding at the end of a non-final chunk (such as greedy unbounded matchers without a closing boundary) emit immediately rather than waiting for subsequent chunks. Tokens that must not split across chunk boundaries should require an explicit closing boundary.

For example:

final items = <String>[];
final parser = letter().plus().flatten().trim();
final out = ChunkedConversionSink<List<String>>.withCallback(
  (chunks) => chunks.forEach(items.addAll),
);
final sink = ParseDecoderSink(parser, out);
sink.add('foo bar');
sink.close();
Inheritance

Constructors

ParseDecoderSink(Parser<R> parser, Sink<List<R>> sink, {ParseMatchCallback<R>? onMatch, ParseErrorCallback? onError, ParseCloseCallback? onClose})
Creates a ParseDecoderSink that outputs to sink.

Properties

hashCode → int
The hash code for this object.
no setterinherited
onClose → ParseCloseCallback?
Callback invoked when conversion closes cleanly.
final
onError → ParseErrorCallback?
Callback invoked when a parse failure occurs.
final
onMatch → ParseMatchCallback<R>?
Callback invoked when a match is produced.
final
parser → Parser<R>
The parser used to produce elements of type R.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sink → Sink<List<R>>
The destination sink for batches of parsed items.
final

Methods

add(String str) → void
Adds chunked data to this sink.
inherited
addSlice(String str, int start, int end, bool isLast) → void
Adds the next chunk to this.
override
asStringSink() → ClosableStringSink
Returns this as a ClosableStringSink.
inherited
asUtf8Sink(bool allowMalformed) → ByteConversionSink
Returns this as a sink that accepts UTF-8 input.
inherited
close() → void
Closes the sink.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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