CappedBytesBuilder class

An in-memory buffer that retains up to maxBytes bytes from streaming data.

Constructors

CappedBytesBuilder(int maxBytes)
Creates a CappedBytesBuilder limited to maxBytes.

Properties

hashCode → int
The hash code for this object.
no setterinherited
isTruncated → bool
True if the stream produced more bytes than maxBytes.
no setter
maxBytes → int
Maximum number of bytes to retain.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalBytes → int
Total number of bytes passed to add, including truncated bytes.
no setter

Methods

add(List<int> chunk) → void
Adds a chunk to the buffer, truncating if maxBytes is reached.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBytesOrNull() → Uint8List?
Returns the accumulated bytes, or null if nothing was added.
toString() → String
A string representation of this object.
inherited

Operators

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