ScheduledFileMessageParams.withFile constructor
Null safety
ScheduledFileMessageParams.withFile(- File file,
- {String? name,
- String? data,
- required int scheduledAt,
- String? customType,
- bool requiredAuth = true,
- bool sendPush = true,
- bool isSilent = false,
- bool markAsRead = true,
- List<MessageMetaArray>? metaArrays,
- AppleCriticalAlertOptions? appleCriticalAlertOptions,
- String? apnsBundleId,
- PushNotificationDeliveryOption pushOption = PushNotificationDeliveryOption.normal,
- 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();
}