loadNext method

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

Load next items asynchronously

Implementation

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

  loading = true;

  final sdk = SendbirdSdk().getInternal();
  final res = await sdk.api.send<UserListQueryResponse>(
    ApplicationUserListRequest(
      token: token,
      limit: limit,
      userIds: userIds,
      metaDataKey: metaDataKey,
      metaDataValues: metaDataValues,
      nicknameStartsWith: nicknameStartsWith,
    ),
  );

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