fetchNext method
- required dynamic onSuccess()?,
- required dynamic onError(
- CometChatException excep
Asynchronously fetches the next set of reactions for a particular message.
This function will invoke the 'fetchNextMessageRequest' method on the platform-specific implementation, passing the limit, messageId, and reaction as parameters. The limit parameter defines the maximum number of message reactions to fetch. The messageId parameter specifies the ID of the message for which reactions are to be fetched. The reaction parameter specifies the reaction to filter with.
Upon success, the function will convert the result into a list of MessageReaction objects and call the onSuccess callback with this list. If an exception occurs during the fetch operation or the conversion of the result, the onError callback will be called with a CometChatException.
@param onSuccess A callback function which is called when the function successfully fetches the next set of reactions. This function is passed the list of fetched MessageReaction objects. @param onError A callback function which is called when an exception occurs during the fetch operation or the conversion of the result. This function is passed a CometChatException detailing the error. @return A Future that completes with a list of MessageReaction objects. If an error occurs, the future completes with an empty list.
Implementation
Future<List<Reaction>> fetchNext(
{required Function(List<Reaction> message)? onSuccess,
required Function(CometChatException excep)? onError}) async {
return await _fetchNextAndPreviousForReactionsRequest(0,
onSuccess: onSuccess, onError: onError);
}