parseWith<R> method
- @useResult
- Parser<
R> parser, { - ParseMatchCallback<
R> ? onMatch, - ParseErrorCallback? onError,
- ParseCloseCallback? onClose,
Parses this stream of strings using parser.
Delegates to StreamParserExtension.parseStreamChunks.
For example:
final parser = letter().plus().flatten().trim();
final stream = Stream.fromIterable(['foo ', 'bar']);
final results = await stream.parseWith(parser).toList();
print(results); // ['foo', 'bar']
Implementation
@useResult
Stream<R> parseWith<R>(
Parser<R> parser, {
ParseMatchCallback<R>? onMatch,
ParseErrorCallback? onError,
ParseCloseCallback? onClose,
}) => parser.parseStreamChunks(
this,
onMatch: onMatch,
onError: onError,
onClose: onClose,
);