getCurrentBlock method

Future<int> getCurrentBlock()

Return the current block of the node.

Implementation

Future<int> getCurrentBlock() async {
  final QueryOptions options = QueryOptions(document: gql(currentBlockQuery));
  final QueryResult result = await _client.query(options);

  if (result.hasException) {
    printIfDebug(result.exception.toString());
    throw Exception('Unexpected error happened in graphql request');
  } else {
    return result.data!['currentBlock']['number'];
  }
}