ScheduledFileMessageCreateParams.withFile constructor
- File file,
- {required int scheduledAt,
- String? fileName,
- String? customType,
- String? data,
- MentionType mentionType = MentionType.users,
- List<
MessageMetaArray> ? metaArrays, - AppleCriticalAlertOptions? appleCriticalAlertOptions,
- PushNotificationDeliveryOption pushNotificationDeliveryOption = PushNotificationDeliveryOption.normal}
withFile
Implementation
ScheduledFileMessageCreateParams.withFile(
File file, {
required this.scheduledAt,
this.fileName,
this.customType,
this.data,
this.mentionType = MentionType.users,
this.metaArrays,
this.appleCriticalAlertOptions,
this.pushNotificationDeliveryOption = PushNotificationDeliveryOption.normal,
}) {
if (kIsWeb) {
sbLog.e(StackTrace.current,
"`ScheduledFileMessageCreateParams.withFile()` is not supported for web.");
throw SendbirdException(
message:
"`ScheduledFileMessageCreateParams.withFile()` is not supported for web.");
}
String? fileMimeType;
if (lookupMimeType(file.path) == null) {
switch (getFileExtension(file.path)) {
case '.HEIC':
fileMimeType = 'image/heic';
break;
case '.HEIF':
fileMimeType = 'image/heif';
break;
default:
sbLog.w(StackTrace.current, 'Unknown file mimeType');
break;
}
} else {
fileMimeType = lookupMimeType(file.path)!;
}
fileInfo = FileInfo.fromFile(
fileName: fileName ?? 'file',
file: file,
mimeType: fileMimeType,
);
}