Flutter: flutter_downloader SQL not working properly

Viewed 65

I followed the setup instructions exactly to set up flutter_downloader. 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",
);

Anything I'm doing wrong?

0 Answers
Related