fluttercommunity / fluttercommunity/flutter_downloader
[Easy fix] Issue with multiple isolates and FlutterDownloader.registerCallback
- Dominant language
- Kotlin
- Stars
- 940
- Forks
- 561
- Avg merge
- 1h 18m
- Merged PRs (30d)
- 1
Description
Hi,
I work with multiple isolates and each one is scheduled with AlarmManager (https://pub.dev/packages/android_alarm_manager) and each one can start task with FlutterDownloader.
As you known, we must not register multiple ports to an isolate name.
So we have an issue around FlutterDownloader.registerCallback(downloadCallback);
The callback must take an other parameter "isolateNameServer";
Actually this is my callback
```dart
static void downloadCallback(String id, DownloadTaskStatus status, int progress) {
final SendPort send = IsolateNameServer.lookupPortByName('downloader_send_port');
print("Task: $id, status: $status, progress $progress");
send.send([id, status, progress]);
}
```
As the callback is a static we can't change his port name.
Is this little upgrade possible ?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.