status method

  1. @override
Future<Map> status()
override

Query the status endpoint of the replica. This normally has a few fields that corresponds to the version of the replica, its root public key, and any other information made public. @returns A JsonObject that is essentially a record of fields from the status endpoint.

Implementation

@override
Future<Map> status() async {
  var response = await _fetch!(
    endpoint: "/api/v2/status",
    headers: {},
    method: FetchMethod.get,
  );

  if (!(response["ok"] as bool)) {
    // ignore: prefer_adjacent_string_concatenation
    throw 'Server returned an error:\n' +
        '  Code: ${response["statusCode"]} (${response["statusText"]})\n' +
        '  Body: ${response["body"]}\n';
  }

  final buffer = response["arrayBuffer"] as Uint8List;

  return cbor.cborDecode<Map>(buffer);
}