0 purchases
stream chunker
Breaks a stream into chunks for analysis or processing.
Usage #
You can also find this in the /example folder.
import 'package:stream_chunker/stream_chunker.dart';
void main() {
// Create a stream
Stream<int> stream = Stream.fromIterable("Hello world!".runes.toList());
// Create chunker to get chunks of size 6
final chunker = StreamChunker<int>(6);
// Transform the original stream into chunks
final chunkedStream = stream.transform(chunker);
// Print the chunks
int i = 0;
chunkedStream.listen((chunk) {
var text = String.fromCharCodes(chunk);
print('Chunk $i: $text');
});
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.