ReactionsController class
A controller class to manage message reactions.
This controller handles adding, removing, and toggling reactions for messages, and notifies listeners when the reaction state changes.
- Inheritance
-
- Object
- ChangeNotifier
- ReactionsController
Constructors
- ReactionsController({required String currentUserId})
- Creates a reactions controller.
Properties
- currentUserId → String
-
The ID of the current user.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
addReaction(
String messageId, String emoji, {String? userName}) → void -
Adds a reaction with the given
emojito amessageId. -
clearAllReactions(
) → void - Clears all reactions for all messages.
-
clearReactions(
String messageId) → void -
Clears all reactions for a specific
messageId. -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
getAllReactions(
) → Map< String, List< Reaction> > - Returns an unmodifiable map of all reactions for persistence.
-
getReactionCounts(
String messageId) → Map< String, int> -
Returns a map of reaction counts for a given
messageId. -
getReactions(
String messageId) → List< Reaction> -
Retrieves the list of reactions for a given
messageId. -
getRecentEmojis(
{required List< String> defaultEmojis}) → Future<List< String> > -
hasUserReacted(
String messageId, String emoji) → bool -
Checks if the current user has reacted with a specific
emojito amessageId. -
loadReactions(
String messageId, List< Reaction> reactions) → void -
Loads a list of
reactionsfor a givenmessageIdfrom an external source. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
removeReaction(
String messageId, String emoji) → void -
Removes a reaction with the given
emojifrom amessageId. -
toggleReaction(
String messageId, String emoji, {String? userName}) → void -
Toggles a reaction with the given
emojifor amessageId. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited