EMMessage.createVoiceSendMessage constructor Null safety

EMMessage.createVoiceSendMessage(
  1. {required String username,
  2. required String filePath,
  3. int duration = 0,
  4. int? fileSize,
  5. String? displayName}
)

Creates a voice message for sending.

Param username The ID of the message recipient.

  • For a one-to-one chat, it is the username of the peer user.
  • For a group chat, it is the group ID.
  • For a chat room, it is the chat room ID.

Param filePath The path of the voice file.

Param duration The voice duration in seconds.

Param fileSize The size of the voice file, in bytes.

Param displayName The name of the voice file which ends with a suffix that indicates the format of the file. For example "voice.mp3".

Return The message instance.

Implementation

EMMessage.createVoiceSendMessage({
  required String username,
  required String filePath,
  int duration = 0,
  int? fileSize,
  String? displayName,
}) : this.createSendMessage(
          to: username,
          body: EMVoiceMessageBody(
              localPath: filePath,
              duration: duration,
              fileSize: fileSize,
              displayName: displayName));