uploadBytes method
Uploads a file to the backend from a list of bytes.
If not provided, mimeType
defaults to application/octet-stream
.
Throws an ApiException if the upload fails.
Implementation
Future<FileMetadata> uploadBytes({
required String fileName,
required List<int> fileContents,
String? fileId,
String? bucketId,
String mimeType = applicationOctetStreamType,
UploadProgressCallback? onUploadProgress,
}) async {
return await _uploadMultipartFile(
file: http.MultipartFile.fromBytes(
'file',
fileContents,
filename: fileName,
contentType: MediaType.parse(mimeType),
),
fileName: fileName,
fileId: fileId,
bucketId: bucketId,
onUploadProgress: onUploadProgress,
);
}