addDownload method

Future<DownloadResponse> addDownload({
  1. required String name,
  2. required String url,
  3. required String httpMethod,
  4. required String moduleName,
  5. Map<String, dynamic>? payload,
})

Implementation

Future<DownloadResponse> addDownload({
  required String name,
  required String url,
  required String httpMethod,
  required String moduleName,
  Map<String, dynamic>? payload,
}) async {
  _triggerFlyAnimation();

  final result = await repo.createDownload(
    name: name,
    url: url,
    httpMethod: httpMethod,
    moduleName: moduleName,
    payload: jsonEncode(payload ?? {}),
  );

  if (result.success) {
    await loadDownloadsIfNeeded(force: true);
  }

  return result;
}