peers method

Future<List<Peer>> peers()

Get list of consolidated peers

Implementation

Future<List<Peer>> peers() async {
  try {
    var response = await sendMessage(formatRequest(method: 'peers'))
        .then((Map<String, dynamic> data) {
      if (data.containsKey('result')) {
        return List<Peer>.from(data['result']);
      } else if (data.containsKey('error')) {
        throw NodeException.fromJson(data['error']);
      }
    });
    return response!;
  } on NodeException catch (e) {
    throw NodeException(code: e.code, message: '{"peers": "${e.message}"}');
  }
}