removeReaction static method

Future<BaseMessage?> removeReaction(
  1. int messageId,
  2. String reaction, {
  3. required dynamic onSuccess(
    1. BaseMessage
    )?,
  4. required dynamic onError(
    1. CometChatException excep
    )?,
})

Remove a reaction to a message.

The messageId parameter specifies the ID of the message to add the reaction to. The reaction parameter specifies the reaction to add. The onSuccess function is called with the added BaseMessage when the reaction is added successfully. The onError function is called with a CometChatException object when there is an error while adding the reaction.

Returns a Future that resolves to the added BaseMessage or null if there was an error.

Implementation

static Future<BaseMessage?> removeReaction(int messageId, String reaction,
    {required Function(BaseMessage)? onSuccess,
    required Function(CometChatException excep)? onError}) async {
  try {
    final result = await channel.invokeMethod(
        'removeReaction', {'messageId': messageId, 'reaction': reaction});
    final BaseMessage res = BaseMessage.fromMap(result);
    if (onSuccess != null) onSuccess(res);
    return res;
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
  return null;
}