Skip to content

Background Isolate broken on Flutter version 3.3.2 in release mode #245

Open
@JoshJuncker

Description

@JoshJuncker

I upgraded to flutter 3.3.2 from 3.0.5, and I get the following error in release mode. Debug mode works fine, and 3.0.5 works fine.
Note that the error only happens upon enqueueing a background upload. Not upon registering the backgroundHandler.
The error results in no callbacks getting called in the dart code (the backgroundHandler isn't ever called). Although you can see the plugin logs from the native code logging the status and completion of the actual upload.

2022-09-28 10:57:50.270160-0600 Runner[3606:1898388] [VERBOSE-2:shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:shout_flutter/utilities/service_locator.dart' not found.
2022-09-28 10:57:50.270335-0600 Runner[3606:1898388] [VERBOSE-2:dart_isolate.cc(668)] Could not resolve main entrypoint function.
2022-09-28 10:57:50.270420-0600 Runner[3606:1898388] [VERBOSE-2:dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
2022-09-28 10:57:50.271344-0600 Runner[3606:1898388] [VERBOSE-2:runtime_controller.cc(385)] Could not create root isolate.
2022-09-28 10:57:50.271429-0600 Runner[3606:1898388] [VERBOSE-2:shell.cc(604)] Could not launch engine with configuration.

Note that 'package:shout_flutter/utilities/service_locator.dart' is simply the dart file that contains the top level backgroundHandler function (copied directly from the readme).
It seems something is wrong when it tries to boot the isolate with the top level function. I don't know what might have changed with isolates and top level functions from flutter 3.0.5 to 3.3.2. But I am using the same version/ref of flutter_uploader in both cases.

flutter_uploader:
    dependency: "direct main"
    description:
      path: "."
      ref: HEAD
      resolved-ref: c27820c84e2a6269997fb61f2fd0736c0841a7bb
      url: "https://github.com/fluttercommunity/flutter_uploader"
    source: git
    version: "3.0.0-beta.4"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions