sendMessage method

Future<void> sendMessage({
  1. required Participant to,
  2. required String type,
  3. required Map<String, dynamic> message,
  4. Uint8List? attachment,
  5. bool ignoreOffline = false,
})

Implementation

Future<void> sendMessage({
  required Participant to,
  required String type,
  required Map<String, dynamic> message,
  Uint8List? attachment,
  bool ignoreOffline = false,
}) async {
  if (_sendTask == null) {
    throw RoomServerException("Cannot send messages because messaging has not been started");
  }
  final queued = _QueuedRoomMessage(
    fromParticipantId: room.localParticipant?.id ?? "",
    to: to,
    type: type,
    message: message,
    attachment: attachment,
    dropIfOffline: ignoreOffline,
  );
  _queueMessage(queued);
  final completer = queued.completer;
  if (completer != null) {
    await completer.future;
  }
}