fluttercommunity / fluttercommunity/flutter_downloader

[Easy fix] Issue with multiple isolates and FlutterDownloader.registerCallback

Open
#306 1 comment 10 reactions 0 assignees View on GitHub
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.