parseStreamChunks method
- @useResult
- Stream<
String> stream, { - ParseMatchCallback<
R> ? onMatch, - ParseErrorCallback? onError,
- ParseCloseCallback? onClose,
Parses chunks of text from stream into a progressive Stream of R.
See ParseDecoderSink for chunk-boundary behavior and callbacks.
For example:
final parser = seq3(char('<'), word().plus(), char('>')).flatten();
final chunks = Stream.fromIterable(['<al', 'pha><be', 'ta>']);
final results = await parser.parseStreamChunks(chunks).toList();
print(results); // ['<alpha>', '<beta>']
Implementation
@useResult
Stream<R> parseStreamChunks(
Stream<String> stream, {
ParseMatchCallback<R>? onMatch,
ParseErrorCallback? onError,
ParseCloseCallback? onClose,
}) => stream
.transform(
toConverter(onMatch: onMatch, onError: onError, onClose: onClose),
)
.expand((elements) => elements);