tusUpload method
Uploads files to the Assembly via the Tus protocol.
Implementation
Future<void> tusUpload(String assemblyURL, String tusURL,
{Function(double)? onProgress, Function()? onComplete}) async {
Map<String, String> metadata = {"assembly_url": assemblyURL};
if (files.isNotEmpty) {
for (var key in files.keys) {
metadata["fieldname"] = key;
metadata["filename"] = basename(files[key]?.name ?? '');
TusClient client = TusClient(Uri.parse(tusURL), files[key]!,
metadata: metadata, maxChunkSize: 10 * 1024 * 1024);
client.upload(
onProgress: (progress) {
if (onProgress != null) {
onProgress(progress);
}
},
onComplete: () {
if (onComplete != null) {
onComplete();
}
},
);
}
}
}