fetchReactions method

void fetchReactions([
  1. String reaction = ReactionConstants.allReactions
])

Implementation

void fetchReactions([String reaction = ReactionConstants.allReactions]) {
  if (reactionsRequests.containsKey(reaction)) {
    ReactionsRequest? request = reactionsRequests[reaction];
    isLoading = true;
    request?.fetchPrevious(
      onSuccess: (messageReactionsList) {
        if (messageReactionsList.isEmpty) {
          hasMoreReactions[reaction] = false;
        } else {
          hasMoreReactions[reaction] = true;
          for (Reaction messageReaction in messageReactionsList) {
            addReactionInMap(messageReaction);
          }
        }
        update();
        isLoading = false;
      },
      onError: (excep) {
        error = excep;
        hasError = true;
        isLoading = false;
        update();
      },
    );
  }
}