next method

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

Gets the list of next items.

Implementation

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

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

  isLoading = true;

  final req = BannedUserListRequest(
    chat,
    limit: limit,
    channelType: channelType,
    channelUrl: channelUrl,
    token: token,
  );

  UserListQueryResponse<RestrictedUser> res;
  try {
    res =
        await chat.apiClient.send<UserListQueryResponse<RestrictedUser>>(req);

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

  isLoading = false;
  return res.users;
}