flutter_downloader icon indicating copy to clipboard operation
flutter_downloader copied to clipboard

loadTasks doesn't return tasks reliably on simulator iPhone 12 iOS 14.5

Open daveshirman opened this issue 3 years ago • 2 comments

I followed the setup instructions exactly. I'm starting downloads from a method like so, which does show progress in the callback (exactly as in the docs):

  Future<String?> startDownload(String url) async {
    Directory directory = await getApplicationDocumentsDirectory();
    final taskId = await FlutterDownloader.enqueue(
      url: url,
      savedDir: directory.path,
      showNotification: true, // Android only
      openFileFromNotification: false, // Android only
    );
    return taskId;
  }

Yet, calling the method as described in the docs:

List<DownloadTask>? tasks = await FlutterDownloader.loadTasks();

Often results in zero results, even though you have started a download prior. This seems completely random.

I've also tried with a query with the same result, zero items. e.g.

List<DownloadTask>? tasks = await FlutterDownloader.loadTasksWithRawQuery(
  query: "SELECT * FROM task",
);

daveshirman avatar Jul 14 '21 16:07 daveshirman

Similar problem for me too

Swat2k avatar Jul 25 '22 05:07 Swat2k

Same issue i facing.

ms-biztech avatar Aug 05 '22 08:08 ms-biztech

Same issue i facing.

NiuXiaoGuang avatar Oct 18 '22 07:10 NiuXiaoGuang

The databaseQueue might be static? Using loadTasksWithRawQuery while NSURLSession calling back and updating database, it can cause database locking problem.

ChiHoc avatar Dec 07 '22 18:12 ChiHoc