You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! When i try to dowanload with listen to progress i only get progress: 0, thn some negative value and at the end 100. Nothing in between. What could be wrong?
Future<void> _initialize() async {
await _initializePreferences();
refreshDownloadTasks();
bindBackgroundIsolate();
FlutterDownloader.registerCallback(downloadCallback, step: 1);
}
void bindBackgroundIsolate() {
final isSuccess = IsolateNameServer.registerPortWithName(
_port.sendPort,
'downloader_send_port',
);
if (!isSuccess) {
unbindBackgroundIsolate();
bindBackgroundIsolate();
return;
}
_port.listen((dynamic data) async {
final taskId = (data as List<dynamic>)[0] as String;
final status = DownloadTaskStatus.fromInt(data[1] as int);
final progress = data[2] as int;
logger.i(
'Callback on UI isolate: '
'task ($taskId) is in status ($status) and process ($progress)',
);
if (_tasks.isNotEmpty) {
final task = _tasks.firstWhere((task) => task.taskId == taskId);
task
..status = status
..progress = progress;
// Emit the status change
if (status == DownloadTaskStatus.complete) {
await handleZipFile();
refreshDownloadTasks();
}
_downloadStatusController.add(status);
}
});
}
The text was updated successfully, but these errors were encountered:
Hi! When i try to dowanload with listen to progress i only get progress: 0, thn some negative value and at the end 100. Nothing in between. What could be wrong?
The text was updated successfully, but these errors were encountered: