NIMMessage.fileEmptyMessage constructor

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

Implementation

factory NIMMessage.fileEmptyMessage(
    {required String sessionId,
    required NIMSessionType sessionType,
    required String filePath,
    String? base64,
    int? fileSize,
    required String displayName,
    NIMNosScene nosScene = NIMNosScenes.defaultIm}) {
  var extension = filePath.split('.').last;
  var fileAttachment = NIMFileAttachment(
      path: filePath,
      size: fileSize,
      base64: base64,
      displayName: displayName,
      extension: extension,
      nosScene: nosScene);
  return NIMMessage(
      messageDirection: NIMMessageDirection.outgoing,
      messageType: NIMMessageType.file,
      timestamp: new DateTime.now().millisecondsSinceEpoch,
      status: NIMMessageStatus.sending,
      sessionId: sessionId,
      sessionType: sessionType,
      messageAttachment: fileAttachment);
}