getBlockHash method
Returns the BlockHash for the given block number.
If no block number is provided, it will return the hash of the latest block at chain height.
Implementation
Future<BlockHash> getBlockHash({int? blockNumber}) async {
final List<dynamic> params = <dynamic>[];
if (blockNumber != null) {
params.add(blockNumber);
}
final response = await _provider.send('chain_getBlockHash', params);
if (response.error != null) {
throw Exception(response.error.toString());
}
return Uint8List.fromList(
hex.decode((response.result as String).substring(2)));
}