runFetchService method
dynamic
runFetchService({})
Implementation
runFetchService(
{String? serviceName,
Function? reflectionAgent,
IConfigRF? config,
Map<String, dynamic>? inputData}) async {
reflectionAgent!.call();
Configuration _configuration = new Configuration();
config!.configure(_configuration);
Libs.config = _configuration;
Models modelList = new Models();
_configuration.model.appModels!.register(modelList);
if (inputData!['DeleteOldData'].isNotEmpty) {
//same for non service
print('Deleting old data');
for (var item in inputData['Model'].split(',')) {
if (item.isNotEmpty) {
await db.execute('delete from ${item}');
}
}
// String model = inputData['Model'];
// var splitModels = model.split(',');
// for (int i = 0; i < splitModels.length; i++) {
// if (splitModels[i].isNotEmpty) {
// await db.execute('delete from ${splitModels[i]}');
// }
// }
}
String model = inputData['Model'];
var splitModels = model.split(',');
if (inputData['showNotification'].isNotEmpty)
notify('Download Status:', 'Starting data download!');
for (int i = 0; i < splitModels.length; i++) {
if (splitModels[i].isNotEmpty) {
var modelRF = Libs.appModels.get()[splitModels[i]] as ModelRF;
///???????
await _fetch(null, modelRF.model!,
serviceName: serviceName,
onFetchComplete: onFetchCompleted,
showLoader: false,
config: _configuration,
pageNo: 1,
includeChild: modelRF.fetchIncludeChild ?? false);
}
}
if (inputData['showNotification'].isNotEmpty)
notify(
'Download Status:', 'Data download has been successfully completed!');
}