sendChatroomImageMessage method

Future<NIMResult<NIMChatroomMessage>> sendChatroomImageMessage({
  1. required String roomId,
  2. required String filePath,
  3. String? displayName,
  4. NIMNosScene nosScene = NIMNosScenes.defaultIm,
  5. bool resend = false,
  6. ChatroomMessageAction? action,
})

发送聊天室图片消息

Implementation

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