enqueue method
Enqueues a new upload task described by upload
.
See MultipartFormDataUpload, RawUpload for available configuration.
Implementation
Future<String> enqueue(Upload upload) async {
if (upload is MultipartFormDataUpload) {
return (await _platform.invokeMethod<String>('enqueue', {
'url': upload.url,
'method': describeEnum(upload.method),
'files': (upload.files ?? []).map((e) => e.toJson()).toList(),
'headers': upload.headers,
'data': upload.data,
'tag': upload.tag,
'allowCellular': upload.allowCellular,
}))!;
}
if (upload is RawUpload) {
return (await _platform.invokeMethod<String>('enqueueBinary', {
'url': upload.url,
'method': describeEnum(upload.method),
'path': upload.path,
'headers': upload.headers,
'tag': upload.tag,
'allowCellular': upload.allowCellular,
}))!;
}
throw 'Invalid upload type';
}