build method Null safety

Future<NodeService> build()

Implementation

Future<NodeService> build() async {
  KeyModel primaryKey = await _loadPrimaryKey();
  L0Storage l0Storage = SStorageService(_apiKey!, primaryKey.privateKey);
  Database database = sqlite3
      .open("$_databaseDir/${Bytes.base64UrlEncode(primaryKey.address)}.db");

  NodeService nodeService = NodeService()
    ..blockInterval = _blockInterval
    ..maxTransactions = _maxTransactions
    ..transactionService = TransactionService(database)
    ..blockService = BlockService(database)
    ..primaryKey = primaryKey;
  nodeService.backupService =
      BackupService(l0Storage, database, primaryKey, nodeService.getBlock);
  await nodeService.init();
  return nodeService;
}