addSuscription method
dynamic
addSuscription(
- Stream<(downloadType, int)> stream,
- int id
)
Implementation
addSuscription(Stream<(downloadType, int)> stream, int id) {
try {
sub.addAll({
id: stream.listen((e) {
downloadType tp = e.$1;
if (tp == downloadType.complete) {
--nunRun;
downloadPart();
} else if (tp == downloadType.downloading) {
downloadSize += e.$2;
speed.downloadSize = downloadSize;
mainStatus.speed = speed.speed;
} else if (tp == downloadType.error) {
statusDownload.status = statusDownloadType.errorDownload;
}
}),
});
} catch (e) {
print(e);
}
}