Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop transfer - how to handle #31

Open
d00m303 opened this issue Mar 23, 2024 · 1 comment
Open

Stop transfer - how to handle #31

d00m303 opened this issue Mar 23, 2024 · 1 comment

Comments

@d00m303
Copy link

d00m303 commented Mar 23, 2024

Hello, sorry for my maybe stupid question, but im fighting this all the day ;)
What is the best way to stop current transfer? Im using very large files like 100-300gb and i want to add 'stop' functionality.

await ftpConnect.connect();
bool res = await ftpConnect.downloadFile(
fileName,
File(lista2![currentIndex]),
onProgress: (progressInPercent, totalReceived, fileSize) {
percent = progressInPercent;
received = totalReceived;
total = fileSize;

      status = "DL: ${percent}%";
      if (stop) {
        ftpConnect.sendCustomCommand("QUIT");
        ftpConnect.disconnect();
        downloading = false;
        percent = 0.0;
        done = false;
        stop = false;
        notifyListeners();
      }
      notifyListeners();
    },
  );

Im trying something like this all the day and even when its said Disconnected file is still downloading in bg till i stop the app.
Many thanks for help, greets!

@dithom
Copy link

dithom commented Jun 19, 2024

@d00m303 Were you able to solve this issue? Running into the same problem here, as futures can not be canceled.

Edit: See my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants