serializeTransactions method Null safety
- String blockId
Creates a Uint8List
of the transactions included in a BlockModel
.
This Uint8List
is built as the body of the BlockModel
. It creates a list
of each TransactionModel.serialize bytes prepended by its size obtained
by UtilsCompactSize.toSize.
Implementation
Uint8List serializeTransactions(String blockId) {
BytesBuilder body = BytesBuilder();
List<TransactionModel> txns = getByBlock(base64.decode(blockId));
for (TransactionModel txn in txns) {
Uint8List serialized = txn.serialize();
Uint8List cSize = UtilsCompactSize.toSize(serialized);
body.add(cSize);
body.add(serialized);
}
return body.toBytes();
}