Dev-hwang / flutter_foreground_task

This plugin is used to implement a foreground service on the Android platform.
https://pub.dev/packages/flutter_foreground_task
MIT License
149 stars 108 forks source link

Isolates not starting on release mode #177

Closed khaldrigo closed 12 months ago

khaldrigo commented 1 year ago

I have those issues, my app is working only in debug mode, but when i see it in release, the ForegroundService simply don't start is there anything i can do to fix it? I am already on latest version of the package

E/flutter (12086): [ERROR:flutter/runtime/dart_isolate.cc(667)] Could not resolve main entrypoint function. E/flutter (12086): [ERROR:flutter/runtime/dart_isolate.cc(168)] Could not run the run main Dart entrypoint. E/flutter (12086): [ERROR:flutter/runtime/runtime_controller.cc(422)] Could not create root isolate. E/flutter (12086): [ERROR:flutter/shell/common/shell.cc(614)] Could not launch engine with configuration.

Dev-hwang commented 12 months ago

The pragma annotation is missing. Please add an annotation to the startCallback as shown below.

@pragma('vm:entry-point') // forget
void startCallback() {
  FlutterForegroundTask.setTaskHandler(MyTaskHandler());
}