loadNext method

  1. @override
Future<List<Poll>> loadNext()
override

Load next items asynchronously

Implementation

@override
Future<List<Poll>> loadNext() async {
  if (loading) throw QueryInProgressError();
  if (!hasNext) return [];

  loading = true;

  final sdk = SendbirdSdk().getInternal();
  final res = await sdk.api.send<PollListQueryResponse>(
    PollListGetRequest(
      channelType: params.channelType,
      channelUrl: params.channelUrl,
      token: token,
      limit: limit,
    ),
  );

  loading = false;
  token = res.next;
  hasNext = res.next != '';
  return res.polls;
}