Random-access byte source — any file, any backing store.
The engine reads arbitrary offsets on demand (xref at end of file, objects scattered throughout). This is NOT a forward-only stream — the engine seeks backward and forward. A one-shot socket or pipe that can only read sequentially cannot be a DataSource. Buffer the full content first, or use a backing store with random access.
Memory is O(1) per read (64KB max per call). The full file is never buffered by the engine — only the backing store holds it.
Implement with your backing store: file (pread), memory (sublistView), HTTP (Range header), IndexedDB, web Blob.slice.
A source must stay readable while a handle opened from it is live: a document or an editor reads it again for as long as it is open. On web a source of up to 16 MiB per lane is copied once into the worker when the job starts, and that copy is what the job reads.
Whoever obtained a source closes it. The library never closes a source it was passed.
- Implementers
Properties
Methods
-
close(
) → FutureOr< void> - Releases whatever the source holds (a file handle, a connection). Idempotent. A source that holds nothing implements it as a no-op.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readAt(
int offset, int count) → FutureOr< Uint8List> -
Read
countbytes starting atoffset. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited