sendTransientMessage static method

dynamic sendTransientMessage(
  1. TransientMessage message, {
  2. required dynamic onSuccess()?,
  3. required dynamic onError(
    1. CometChatException excep
    )?,
})

Transient messages are messages that are sent in real-time only

method send transient message

data A JSONObject to provide data.

method could throw PlatformException with error codes specifying the cause

Implementation

static sendTransientMessage(TransientMessage message,
    {required Function()? onSuccess,
    required Function(CometChatException excep)? onError}) async {
  try {
    await channel.invokeMethod('sendTransientMessage', {
      'receiverId': message.receiverId,
      'receiverType': message.receiverType,
      'data': message.data,
    });
    if (onSuccess != null) onSuccess();
  } on PlatformException catch (p) {
    _errorCallbackHandler(null, p, null, onError);
  } catch (e) {
    _errorCallbackHandler(null, null, e, onError);
  }
}