decrement method

ReactionGroupData decrement(
  1. DateTime date
)

Returns a copy of this ReactionGroupData with the count decremented by 1 (not below 0), if the given date is within the valid range (date >= firstReactionAt or date <= lastReactionAt). Otherwise, returns the original instance.

  • Parameter date: The date to check for decrementing.
  • Returns: A new ReactionGroupData with updated count, or the original if not decremented.

Implementation

ReactionGroupData decrement(DateTime date) {
  if (date < firstReactionAt || date > lastReactionAt) return this;
  return copyWith(count: math.max(0, count - 1));
}