ScheduledFileMessageParams.withFile constructor

ScheduledFileMessageParams.withFile(
  1. File file, {
  2. String? name,
  3. String? data,
  4. required int scheduledAt,
  5. String? customType,
  6. bool requiredAuth = true,
  7. bool sendPush = true,
  8. bool isSilent = false,
  9. bool markAsRead = true,
  10. List<MessageMetaArray>? metaArrays,
  11. AppleCriticalAlertOptions? appleCriticalAlertOptions,
  12. String? apnsBundleId,
  13. PushNotificationDeliveryOption pushOption = PushNotificationDeliveryOption.normal,
  14. MentionType mentionType = MentionType.users,
})

Implementation

ScheduledFileMessageParams.withFile(
  File file, {
  this.name,
  this.data,
  required this.scheduledAt,
  this.customType,
  this.requiredAuth = true,
  this.sendPush = true,
  this.isSilent = false,
  this.markAsRead = true,
  this.metaArrays,
  this.appleCriticalAlertOptions,
  this.apnsBundleId,
  this.pushOption = PushNotificationDeliveryOption.normal,
  this.mentionType = MentionType.users,
}) {
  String fileType;

  if (lookupMimeType(file.path) == null) {
    switch (getFileExtension(file.path)) {
      case '.HEIC':
        fileType = 'imgae/heic';
        break;
      case '.HEIF':
        fileType = 'imgae/heif';
        break;
      default:
        throw SBError(message: 'Unknown File Type');
    }
  } else {
    fileType = lookupMimeType(file.path)!;
  }
  uploadFile = FileInfo.fromData(
    name: name ?? 'my_file',
    file: file,
    mimeType: fileType,
  );
  reqId = Uuid().v1();
}