BlockModel constructor Null safety

BlockModel(
  1. {Uint8List? id,
  2. int version = 1,
  3. required Uint8List previousHash,
  4. required Uint8List transactionRoot,
  5. DateTime? timestamp}
)

Buils a new BlockModel.

If no timestamp is provided, it is considered a new BlockModel and the object creation time becomes the timestamp.

Implementation

BlockModel({
  this.id,
  this.version = 1,
  required this.previousHash,
  required this.transactionRoot,
  DateTime? timestamp,
}) : timestamp = timestamp ?? DateTime.now();