download method
Implementation
@override
Future<List<ValidationRule>?> download(
Function(RequestProgress, bool) callback,
{Dio? dioTestClient}) async {
List<DataSet> dataSets = await DataSetQuery(database: database).get();
final queue = Queue(parallel: 50);
num availableItemCount = 0;
dataSets.forEach((dataSet) {
availableItemCount++;
queue.add(() =>
this.downloadOne(dataSet, availableItemCount, (progress, complete) {
callback(progress, complete);
}, dioTestClient: dioTestClient));
});
if (availableItemCount == 0) {
queue.cancel();
} else {
await queue.onComplete;
}
return this.get();
}