uploadFiles method
This function uploads multiples files by calling uploadFile repeatedly
filePaths
the list of paths to the files to upload
filesBytes
the list of byte array of the files to uploaded
Implementation
@Deprecated('Use [uploadResources] instead')
Future<List<CloudinaryResponse>> uploadFiles({
List<String>? filePaths,
List<List<int>>? filesBytes,
String? folder,
CloudinaryResourceType? resourceType,
Map<String, dynamic>? optParams,
}) async {
if ((filePaths?.isEmpty ?? true) && (filesBytes?.isEmpty ?? true)) {
throw Exception('One of filePaths or filesBytes must not be empty');
}
List<CloudinaryResponse> responses = [];
if (filesBytes?.isNotEmpty ?? false) {
responses = await Future.wait(filesBytes!.map((fileBytes) async =>
await uploadFile(
fileBytes: fileBytes,
folder: folder,
resourceType: resourceType,
optParams: optParams))).catchError((err) => throw (err));
}
if (filePaths?.isNotEmpty ?? false) {
responses = await Future.wait(filePaths!.map((filePath) async =>
await uploadFile(
filePath: filePath,
folder: folder,
resourceType: resourceType,
optParams: optParams))).catchError((err) => throw (err));
}
return responses;
}