MemorySource class final

A DataSource backed by an in-memory byte buffer.

The simplest source — wrap a Uint8List you already hold (a download, an asset, a clipboard paste) and read from it. Random access is a plain sublist view, so reads are zero-copy and O(1).

final doc = await pdf.open(MemorySource(pdfBytes));

For data that doesn't fit in memory, back the source with a file or an HTTP range reader instead so the input streams in chunks rather than sitting fully in RAM.

Implemented types

Constructors

MemorySource(Uint8List _bytes)
Wraps bytes without copying. The buffer must not be mutated for the lifetime of any operation reading from this source.

Properties

hashCode int
The hash code for this object.
no setterinherited
length int
Total size in bytes.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readAt(int offset, int count) Uint8List
Read count bytes starting at offset.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited