ParseDecoder<R> class final

A Converter that decodes a String or chunked String stream into lists of parsed elements of type R.

See ParseIterable for callback behavior and ParseDecoderSink for chunk-boundary behavior.

For example:

final parser = letter().plus().flatten().trim();
final decoder = ParseDecoder(parser);
print(decoder.convert('foo bar baz')); // ['foo', 'bar', 'baz']
Inheritance
Annotations
  • @immutable

Constructors

ParseDecoder(Parser<R> parser, {ParseMatchCallback<R>? onMatch, ParseErrorCallback? onError, ParseCloseCallback? onClose})
Creates a ParseDecoder using parser.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
onClose → ParseCloseCallback?
Callback invoked when conversion finishes or closes.
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

Methods

bind(Stream<String> stream) → Stream<List<R>>
Transforms the provided stream.
inherited
cast<RS, RT>() → Converter<RS, RT>
Provides a Converter<RS, RT> view of this stream transformer.
inherited
convert(String input, [int start = 0, int? end]) → List<R>
Decodes the slice of input from start to end into a List of R.
override
fuse<TT>(Converter<List<R>, TT> other) → Converter<String, TT>
Fuses this with other.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startChunkedConversion(Sink<List<R>> sink) → StringConversionSink
Starts a chunked conversion.
override
toString() → String
A string representation of this object.
inherited

Operators

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