getReplies method
Calls channel.getReplies
updating queryMessage
stream
Implementation
Future<void> getReplies(
String parentId, {
int limit = 50,
bool preferOffline = false,
}) async {
if (_topPaginationEnded ||
_queryTopMessagesController.value ||
channel.state == null) return;
_queryTopMessagesController.safeAdd(true);
Message? message;
if (channel.state!.threads.containsKey(parentId)) {
final thread = channel.state!.threads[parentId]!;
if (thread.isNotEmpty) {
message = thread.first;
}
}
try {
final response = await channel.getReplies(
parentId,
options: PaginationParams(
lessThan: message?.id,
limit: limit,
),
preferOffline: preferOffline,
);
if (response.messages.isEmpty || response.messages.length < limit) {
_topPaginationEnded = true;
}
_queryTopMessagesController.safeAdd(false);
} catch (e, stk) {
_queryTopMessagesController.safeAddError(e, stk);
}
}