getActiveDownloadTasks method

Future<List<AGCStorageDownloadTask>> getActiveDownloadTasks()

Obtains the ongoing download task list under the current reference.

Implementation

Future<List<AGCStorageDownloadTask>> getActiveDownloadTasks() async {
  try {
    final List<dynamic>? result =
        await _methodChannel.invokeMethod<List<dynamic>?>(
      'AGCStorageReference#getActiveDownloadTasks',
      <String, dynamic>{
        'bucket': storage.bucket,
        'policyIndex': storage.policy?.index,
        'objectPath': path,
      },
    );
    return (result ?? <String>[])
        .cast<String>()
        .map((String taskId) => AGCStorageDownloadTask._(taskId, this))
        .toList(growable: false);
  } catch (e) {
    throw AGCStorageException._from(e);
  }
}