FileMessageCreateParams.withFileBytes constructor
- Uint8List fileBytes,
- {String? fileName,
- String? mimeType,
- String? data,
- String? customType,
- MentionType? mentionType,
- List<
String> ? mentionedUserIds, - List<
MessageMetaArray> ? metaArrays, - int? parentMessageId,
- bool? replyToChannel,
- PushNotificationDeliveryOption pushNotificationDeliveryOption = PushNotificationDeliveryOption.normal,
- bool isPinnedMessage = false}
withFileBytes
Implementation
FileMessageCreateParams.withFileBytes(
Uint8List fileBytes, {
String? fileName,
String? mimeType,
String? data,
String? customType,
MentionType? mentionType,
List<String>? mentionedUserIds,
List<MessageMetaArray>? metaArrays,
int? parentMessageId,
bool? replyToChannel,
PushNotificationDeliveryOption pushNotificationDeliveryOption =
PushNotificationDeliveryOption.normal,
bool isPinnedMessage = false,
}) : super(
data: data,
customType: customType,
mentionType: mentionType ?? MentionType.users,
mentionedUserIds: mentionedUserIds,
metaArrays: metaArrays,
parentMessageId: parentMessageId,
replyToChannel: replyToChannel ?? false,
pushNotificationDeliveryOption: pushNotificationDeliveryOption,
isPinnedMessage: isPinnedMessage,
) {
String? fileMimeType = lookupMimeType('', headerBytes: fileBytes);
if (fileMimeType != null) {
mimeType = fileMimeType;
} else if (mimeType == null) {
sbLog.w(StackTrace.current, 'Unknown file mimeType');
}
fileInfo = FileInfo.fromFileBytes(
fileBytes: fileBytes,
fileName: fileName ?? 'file',
mimeType: mimeType,
);
}