next method
override
Gets the list of FeedChannels. The queried result is passed to handler
as list.
If this method is repeatedly called after each next is finished,
it retrieves the following pages of the FeedChannel list.
If there is no more pages to be read, an empty list (not null
) is returned.
@since 4.0.1
Implementation
@override
Future<List<FeedChannel>> next() async {
sbLog.i(StackTrace.current);
if (isLoading) throw QueryInProgressException();
if (!hasNext) return [];
isLoading = true;
final options = [
if (includeEmpty) ChannelListQueryIncludeOption.includeEmpty,
ChannelListQueryIncludeOption.includeMember,
ChannelListQueryIncludeOption.includeReadReceipt,
ChannelListQueryIncludeOption.includeDeliveryReceipt,
];
final res =
await chat.apiClient.send<FeedChannelListQueryResponse>(
FeedChannelListRequest(
chat,
limit: limit,
options: options,
token: token,
),
);
for (final element in res.channels) {
element.set(chat);
}
isLoading = false;
token = res.next;
hasNext = res.next != '';
return res.channels;
}