createScheduledFileMessage method
Creates a file message to be sent at the specified time.
Implementation
Future<FileMessage> createScheduledFileMessage(
ScheduledFileMessageCreateParams params,
) async {
sbLog.i(StackTrace.current, 'fileMessageParams.name: ${params.fileName}');
UploadResponse? upload;
if (params.fileInfo.hasBinary) {
upload = await chat.apiClient
.send<UploadResponse>(GroupChannelScheduledFileUploadRequest(
chat,
channelUrl: channelUrl,
params: params,
))
.timeout(
Duration(seconds: chat.chatContext.options.fileTransferTimeout),
onTimeout: () {
throw SendbirdException(code: SendbirdError.fileUploadTimeout);
});
params.fileInfo
..fileSize = upload.fileSize
..fileUrl = upload.url;
}
return await chat.apiClient.send<FileMessage>(
GroupChannelScheduledFileMessageSendRequest(
chat,
channelUrl: channelUrl,
params: params,
),
);
}