Skip to content

Callback registered on ReceivePort to process events from background isolate is never called (iOS) #751

@jorg1piano

Description

@jorg1piano

Describe the bug
The callback registered on the ReceivePort that processes events from the background isolate on the UI isolate is not called. The example app suffers from the same problem. The callback is never called so the UI is never updated.

The files get downloaded, it just seems like the communication between the isolates are broken somehow.

Steps to reproduce the behavior:

  1. Run git clone https://github.com/fluttercommunity/flutter_downloader.git
  2. Run git checkout c577e4a3b933e3a4914910cd9559626f39980f95
  3. Run the example app
  4. Observe that the chunk below is never called (ex: the message "Callback on UI isolate: " is never printed to the console)

lib/home_page.dart

  _port.listen((dynamic data) {
      final taskId = (data as List<dynamic>)[0] as String;
      final status = data[1] as DownloadTaskStatus;
      final progress = data[2] as int;

      print(
        'Callback on UI isolate: '
        'task ($taskId) is in status ($status) and process ($progress)',
      );
     // ...Some more code 
  });

Expected behavior
The callback should be called. And the UI state should be updated.

Device information:

  • Device: iPhone 12
  • OS: ios 15.6.1
  • plugin version v1.9.0

Additional context
Seems to work fine on Android.

Relevant output from flutter doctor -v

[✓] Flutter (Channel master, 3.5.0-12.0.pre.139, on macOS 12.3 21E230 darwin-arm64, locale en-NO)
    • Flutter version 3.5.0-12.0.pre.139 on channel master at /Users/jorgen/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5280135882 (4 hours ago), 2022-11-06 12:24:25 -0500
    • Engine revision ecd3c48578
    • Dart version 2.19.0 (build 2.19.0-374.0.dev)
    • DevTools version 2.19.0

[✓] Xcode - develop for iOS and macOS (Xcode 13.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13F17a
    • CocoaPods version 1.11.3

[✓] VS Code (version 1.73.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.52.0

[✓] HTTP Host Availability
    • All required HTTP hosts are available

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions