MerkelTree.build constructor Null safety

MerkelTree.build(
  1. List<Uint8List> hashes
)

Builds this Mekel Tree from a list of hashes.

Implementation

MerkelTree.build(this.hashes) {
  if (hashes.length == 1) {
    Uint8List hash = hashes.single;
    proofs[hash] = (BytesBuilder()
          ..addByte(1)
          ..add(hash))
        .toBytes();
    root = Digest("SHA3-256").process((BytesBuilder()
          ..add(hash)
          ..add(hash))
        .toBytes());
    depth = 1;
  } else {
    root = _calculate([...hashes]);
  }
}