fix(llc): fix cannot modify immutable list.
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -997,26 +997,24 @@ class Channel {
|
|||||||
) async {
|
) async {
|
||||||
final type = reaction.type;
|
final type = reaction.type;
|
||||||
|
|
||||||
final reactionCounts = {...message.reactionCounts ?? <String, int>{}};
|
final reactionCounts = {...?message.reactionCounts};
|
||||||
if (reactionCounts.containsKey(type)) {
|
if (reactionCounts.containsKey(type)) {
|
||||||
reactionCounts.update(type, (value) => value - 1);
|
reactionCounts.update(type, (value) => value - 1);
|
||||||
}
|
}
|
||||||
final reactionScores = {...message.reactionScores ?? <String, int>{}};
|
final reactionScores = {...?message.reactionScores};
|
||||||
if (reactionScores.containsKey(type)) {
|
if (reactionScores.containsKey(type)) {
|
||||||
reactionScores.update(type, (value) => value - 1);
|
reactionScores.update(type, (value) => value - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
final latestReactions = [...message.latestReactions ?? <Reaction>[]]
|
final latestReactions = [...?message.latestReactions]..removeWhere((r) =>
|
||||||
..removeWhere((r) =>
|
r.userId == reaction.userId &&
|
||||||
r.userId == reaction.userId &&
|
r.type == reaction.type &&
|
||||||
r.type == reaction.type &&
|
r.messageId == reaction.messageId);
|
||||||
r.messageId == reaction.messageId);
|
|
||||||
|
|
||||||
final ownReactions = message.ownReactions
|
final ownReactions = [...?message.ownReactions]..removeWhere((r) =>
|
||||||
?..removeWhere((r) =>
|
r.userId == reaction.userId &&
|
||||||
r.userId == reaction.userId &&
|
r.type == reaction.type &&
|
||||||
r.type == reaction.type &&
|
r.messageId == reaction.messageId);
|
||||||
r.messageId == reaction.messageId);
|
|
||||||
|
|
||||||
final newMessage = message.copyWith(
|
final newMessage = message.copyWith(
|
||||||
reactionCounts: reactionCounts..removeWhere((_, value) => value == 0),
|
reactionCounts: reactionCounts..removeWhere((_, value) => value == 0),
|
||||||
|
|||||||
Reference in New Issue
Block a user