addTask method

Future<String> addTask(
  1. List<String> urls, {
  2. VoidCallback? onComplete,
  3. VoidCallback? onError,
})

add download task return gid

Implementation

Future<String> addTask(List<String> urls,
    {VoidCallback? onComplete, VoidCallback? onError}) async {
  if (client != null) {
    final opt = await createAriaTaskOption(extraOptions: {});
    final gid = await addAriaTask(
        urls: urls,
        client: client!,
        options: opt,
        onComplete: onComplete ?? () {},
        onError: onError ?? () {});
    return gid;
  }
  throw Aria2Error(message: 'please connect  first');
}