Block class

Represents an IPFS block.

Implemented types

Constructors

Block({required CID cid, required Uint8List data, String format = 'raw'})
Creates a new Block with the given cid, data, and format.

Properties

cid → CID
The content identifier for this block.
final
data → Uint8List
The raw binary data of this block.
final
format → String
The codec format used by this block (e.g., 'raw', 'dag-pb').
final
hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
size → int
The size of this block in bytes.
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBytes() → Uint8List
Serializes the block to bytes.
override
toString() → String
A string representation of this object.
inherited
validate() → Future<bool>
Validates the block's content hash matches its CID.
override
validateSync() → bool
Synchronous structural validation.

Operators

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

Static Methods

fromData(Uint8List data, {String format = 'raw'}) → Future<Block>
Creates a block from raw data, automatically computing the CID.