removeReactionFromMap method

void removeReactionFromMap(
  1. Reaction reaction
)

Implementation

void removeReactionFromMap(Reaction reaction) {
  messageReactions[reaction.reaction!]?.removeWhere(
      (element) => reaction.uid == element.uid && reaction.id == element.id);
  totalReactions--;
  update();
  if (messageReactions[reaction.reaction!]?.isEmpty ?? false) {
    messageReactions.remove(reaction.reaction!);
    selectedReaction = ReactionConstants.allReactions;
  }
  if (messageReactions.isEmpty && context != null) {
    Navigator.pop(context!);
  }
}