listVotes method

Future<List<Vote>> listVotes({
  1. required String voter,
  2. String? author,
  3. String? permlink,
  4. int? limit,
})

Implementation

Future<List<Vote>> listVotes({
  required String voter,
  String? author,
  String? permlink,
  int? limit,
}) async {
  final bodyJson = await _fetchPostData(
    method: 'database_api.list_votes',
    params: <String, dynamic>{
      'start': [voter, author ?? '', permlink ?? ''],
      'limit': limit,
      'order': 'by_voter_comment'
    },
  );

  final result = bodyJson['result'] as Map<String, dynamic>;
  final votes = result['votes'] as List<dynamic>;
  return [
    for (final vote in votes) Vote.fromJson(vote as Map<String, dynamic>)
  ];
}