next method

  1. @override
Future<List<User>> next()
override

Gets the list of next items.

Implementation

@override
Future<List<User>> next() async {
  sbLog.i(StackTrace.current);

  if (isLoading) throw QueryInProgressException();
  if (!hasNext) return [];

  isLoading = true;

  PollVoterListQueryResponse res;
  try {
    res = await chat.apiClient.send<PollVoterListQueryResponse>(
      PollOptionGetListVotersRequest(
        chat,
        limit: limit,
        channelType: params.channelType,
        channelUrl: params.channelUrl,
        pollId: params.pollId,
        pollOptionId: params.pollOptionId,
        token: token,
      ),
    );

    token = res.next;
    hasNext = res.next != '';
  } catch (_) {
    isLoading = false;
    rethrow;
  }

  isLoading = false;
  return res.voters;
}