NIMMessage.imageEmptyMessage constructor

NIMMessage.imageEmptyMessage(
  1. {required String sessionId,
  2. required NIMSessionType sessionType,
  3. required String filePath,
  4. required int fileSize,
  5. String? displayName,
  6. String? base64,
  7. NIMNosScene nosScene = NIMNosScenes.defaultIm}
)

Implementation

factory NIMMessage.imageEmptyMessage(
    {required String sessionId,
    required NIMSessionType sessionType,
    required String filePath,
    required int fileSize,
    String? displayName,
    String? base64,
    NIMNosScene nosScene = NIMNosScenes.defaultIm}) {
  var extension = filePath.split('.').last;

  var imageAttachment = NIMImageAttachment(
      path: filePath,
      size: fileSize,
      displayName: displayName,
      base64: base64,
      extension: extension,
      nosScene: nosScene);
  return NIMMessage(
      messageDirection: NIMMessageDirection.outgoing,
      messageType: NIMMessageType.image,
      timestamp: new DateTime.now().millisecondsSinceEpoch,
      status: NIMMessageStatus.sending,
      sessionId: sessionId,
      sessionType: sessionType,
      messageAttachment: imageAttachment);
}