Closed shahmirzali49 closed 1 year ago
No, I'm not using IsolateGroup, is there a code example available? The documentation is poor and it kinda require vm_service package.
Isolates are spawned here and there is no internall limitation of running 100-200 instances at once.
Also there is not much data sent between the Isolates - it's not the JSON parsing which sends megabytes back and forward, downloaded bytes are writen to the files directly.
yeah, the doc about the isolate group is poor. I just find this resource: https://github.com/dart-lang/sdk/issues/36097
what does mean "Also there is not much data sent between the Isolates"? what is the limit for fileSize? the limit is just for a single isolate or for all isolates? I use can I wanna download 180/200 mp3 files. but one file size is a maximum of 1 MB approximately. I wonder if my file sizes be 10MB what is gonna happen? I can't do that?
According to your link the Isolate Group is internal class and used by default.
You can download as many files as you want, there are no limits in MB, and each downloading proceeds separately.
The filesize
property is not required, it used to specify bytes end for a range header and actually has no limit too.
DownloadManager.instance.init(isolates:200)
download 180/200 mp3 files
Most likely, 100 parallel requests will overload the network too much and will be slower than a queue of 5-10 parallel requests.
Okay, probably I will do what you said: 5-10 requests and then others. thanks for your answers. I really appreciate it.
5-10 requests and then others
// Init 5 isolates which runs in background and wait for requests
final manager = DownloadManager.instance;
await manager.init(isolates: 5)
// Run 100+ downloads, they will be queued automatically
manager.download(url1, path: destination1);
manager.download(url2, path: destination2);
// ...
manager.download(url100, path: destination100);
can I download lots of files/URLs at once? for example like this :
DownloadManager.instance.init(isolates:200)