sendChatroomLocationMessage method

Future<NIMResult<NIMChatroomMessage>> sendChatroomLocationMessage(
  1. {required String roomId,
  2. required double latitude,
  3. required double longitude,
  4. required String address,
  5. bool resend = false,
  6. ChatroomMessageAction? action}
)

发送聊天室地理位置消息

Implementation

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