BlockModel class Null safety
The block model entity for local storage.
This model is used only for local operations. For blockchain operations the serialized version of it is used.
Constructors
- BlockModel({Uint8List? id, int version = 1, required Uint8List previousHash, required Uint8List transactionRoot, DateTime? timestamp})
- Buils a new BlockModel.
- BlockModel.deserialize(Uint8List block)
-
Builds a BlockModel from a
block
list of bytes. -
BlockModel.fromMap(Map<
String, dynamic> map) -
Builds a BlockModel from a
map
.
Properties
- hashCode → int
-
The hash code for this object.
read-only, inherited
- id ↔ Uint8List?
-
The unique identifier of this block.
read / write
- previousHash ↔ Uint8List
-
The previous BlockModel.id.
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- timestamp ↔ DateTime
-
The block creation timestamp.
late, final
- transactionRoot ↔ Uint8List
-
The MerkelTree.root of the transaction hashes that are part of this.
read / write
- version ↔ int
-
The version number indicating the set of block validation rules to follow.
read / write
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited
-
serialize(
) → Uint8List -
Creates the
Uint8List
representation of the block header. -
toString(
) → String -
Overrides toString() method for useful error messages
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited