fluttercommunity / fluttercommunity/flutter_uploader

Background Isolate broken on Flutter version 3.3.2 in release mode

Open
#245 6 comments 3 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
218
Forks
172
PR merge metrics
No merged PRs in 30d

Description

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"
```

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.