queryChain method

Future<RequestResult<Map<String, dynamic>>> queryChain(
  1. String url
)

Queries the chain at the given url.

Implementation

Future<RequestResult<Map<String, dynamic>>> queryChain(
  String url,
) async {
  final data = await _httpClient.get(Uri.parse(url));
  if (data.statusCode != 200) {
    return RequestResult(
      error: 'Call to $url returned status code ${data.statusCode}',
    );
  }

  return RequestResult(
    value: json.decode(utf8.decode(data.bodyBytes)) as Map<String, dynamic>,
  );
}