Block class abstract mixin

A class representing an efficient container for binary data.

Block provides a way to handle binary data with memory efficiency and various access patterns. It supports lazy initialization, caching, and slicing operations.

Constructors

Block(Builder builder)
Creates a new Block from a builder function.
factory
Block.empty()
Creates an empty Block with size 0.
factory
Block.fromBytes(Iterable<Uint8List> bags)
Creates a Block from a collection of byte arrays.
factory
Block.fromStream(Stream<Uint8List> stream, int size)
Creates a Block from a stream of byte arrays.
factory
Block.fromString(Iterable<String> bags, {Encoding encoding = utf8})
Creates a Block from a collection of strings.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size int
Returns the total size of the block in bytes.
no setter

Methods

bytes() Future<Uint8List>
Returns a Future that completes with the entire block's content as a single Uint8List.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
slice(int start, [int? end]) Block
Creates a new Block that is a slice of this block, from start to end.
stream() Stream<Uint8List>
Returns a stream of binary data chunks contained in this block.
text() Future<String>
Returns a Future that completes with the entire block's content as a UTF-8 decoded string.
toString() String
A string representation of this object.
inherited

Operators

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