sendChatroomTipMessage method Null safety

Future<NIMResult<NIMChatroomMessage>> sendChatroomTipMessage(
  1. {required String roomId,
  2. bool resend = false,
  3. ChatroomMessageAction? action}
)

Send a tip message in the chatroom.

Implementation

Future<NIMResult<NIMChatroomMessage>> sendChatroomTipMessage({
  required String roomId,
  bool resend = false,
  ChatroomMessageAction? action,
}) async {
  return _createMessage({
    'roomId': roomId,
    'messageType': 'tip',
  }).then((messageResult) async {
    if (messageResult.isSuccess) {
      final message = messageResult.data as NIMChatroomMessage;
      await action?.call(message);
      return sendChatroomMessage(message, resend);
    } else {
      return messageResult;
    }
  });
}