Skip to content
pubscout

chunked_stream

1.4.2, released 4 years ago by google.dev

Utilities for working with chunked streams such as Stream<List<int>>

WASM-readyQuiet but busy
$ flutter pub add chunked_stream
Source repository

What it does

Provides helpers to read byte streams into a single Uint8List and to iterate over chunked streams element‑by‑element. It also offers a utility to wrap any Stream<T> as a chunked Stream<List<T>>.

AI-written summary of version 1.4.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Reading a file or network response as a byte stream and converting it to a single buffer
  • Iterating over a byte stream one byte or a fixed number of bytes at a time
  • Wrapping a non‑chunked stream into a chunked form for batch processing

Skip it when

  • When you need advanced stream manipulation beyond simple chunking, consider using the async package’s ChunkedStreamReader directly

Strengths

  • Simple API with readByteStream and readBytes
  • Supports both reading entire streams and incremental iteration
  • No external dependencies beyond meta
  • Cross‑platform support (android, ios, web, windows, macos, linux)

Weaknesses

  • ChunkedStreamIterator is deprecated in favor of async’s ChunkedStreamReader
  • Very small feature set – only basic chunk handling

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1
import 'dart:io';
import 'dart:convert';
import 'package:chunked_stream/chunked_stream.dart';

Future<void> main() async {
  Stream<List<int>> fileStream = File('README.md').openRead();
  final Uint8List bytes = await readByteStream(fileStream);
  print(utf8.decode(bytes));
}

Alternatives

Packages that do the same job and could replace chunked_stream.

Works with

Packages commonly used together with chunked_stream: ones it builds on, ones built on it, and its own family.