question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed assertion: line 74 pos 12: 'Directory(savedDir).existsSync()': is not true.

See original GitHub issue

I’m doing everything like the repo example:

String localPath = (await _findLocalPath()) + Platform.pathSeparator + 'Download';
          print(localPath);
          await FlutterDownloader.enqueue(
            url: "https://cdn.pixabay.com/photo/2016/09/05/10/50/app-1646213_960_720.png",
            savedDir: localPath,
            showNotification: true, // show download progress in status bar (for Android)
            openFileFromNotification: true, // click on notification to open downloaded file (for Android)
          );

localPath printed value is :

/storage/emulated/0/Android/data/com.getinshoot.getinshoot/files/Download

I still have the error:

Failed assertion: line 74 pos 12: ‘Directory(savedDir).existsSync()’: is not true.

Any idea what’s happening?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:5

github_iconTop GitHub Comments

8reactions
baptisteArnocommented, Feb 26, 2020

I forgot to actually create this directory before.

String localPath = (await _findLocalPath()) + Platform.pathSeparator + 'Download';
          final savedDir = Directory(localPath);
          bool hasExisted = await savedDir.exists();
          if (!hasExisted) {
            savedDir.create();
          }
0reactions
hiteshsurbhiinfotechcommented, Apr 12, 2022

Some delay to after getting localpath solved my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

flutter - 'file.existsSync()': is not true - Stack Overflow
The error says it, the file doesn't exists, before doing that you should check if the file is there or create it if...
Read more >
existsSync method - FileSystemEntity class - dart:io library
Calling existsSync on an instance of one of these subclasses checks whether the object exists in the file system object exists and is...
Read more >
[Solved]-'file.existsSync()': is not true-Flutter - appsloveworld
The error says it, the file doesn't exists, before doing that you should check if the file is there or create it if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found