Closed shahmirzali49 closed 1 year ago
is there listen function for error ?
@Shahmirzali-Huseynov
request.events.listen((_) {
// Progress and Success
}, onError: (_) {
// Failure
});
thanks
@starkdmi when I close the internet nothing happens in onError callback. shouldn't it give an error?
@Shahmirzali-Huseynov do you expect an error? The downloading continues on re-connect. It's an http package behaviour, maybe there is some timeout though.
@starkdmi hmm, I tested yeah you are right.
but also when I go home screen or other when downloading starts, 1,2,3+ minute later the progress stuck, the same number, and does not continue, I don't know. What can I do in this situation?
@Shahmirzali-Huseynov, the home screen of your app, or an iPhone home screen?
@starkdmi iPhone home screen or switch to other apps. it happens not in debug mode, it happens in real device release mode.
@starkdmi I will do some logger in the next few days too for what going on background 😅
@Shahmirzali-Huseynov, I see two possibilities: 1) The app was really paused by the system 2) The downloading continues, but not the logging
@starkdmi If the progress continues why is not affecting to UI ?
@Shahmirzali-Huseynov, you should check the file system, are download directory increasing in size? Keep in mind that Flutter UI has its limitations on work in background mode.
okay, I will inform you.
Sorry for the late response. I paused when the app went to the background(not terminated) and when back to the app I'm resuming.
note to those who want to know about syntax: I'm using flutter_hooks
and riverpod
.
useOnAppLifecycleStateChange((previous, current) async {
appLifecycleState.value = current;
log('AppLifecycleState $current');
if (current == AppLifecycleState.resumed) {
if (ref.read(isolateDownloadNotifierProvider.notifier).isPaused()) {
ref.read(isolateDownloadNotifierProvider.notifier).resumeDownload();
}
log('AppLifecycleState.resumed');
} else if (current == AppLifecycleState.inactive) {
ref.read(isolateDownloadNotifierProvider.notifier).pauseDownload();
}
});
I want to stop downloads and clear when any errors happen. how can I do ? I didn't see anything about in the readme