flutterdartdart-isolatesbackground-fetch

Dart Error: Dart_LookupLibrary: library 'package:background_fetch/background_fetch.dart' not found


How can I solve this problem:

E/flutter (18287): [ERROR:flutter/shell/common/shell.cc(89)] Dart Error: Dart_LookupLibrary: library 'package:background_fetch/background_fetch.dart' not found.
E/flutter (18287): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter (18287): [ERROR:flutter/runtime/dart_isolate.cc(168)] Could not run the run main Dart entrypoint.
E/flutter (18287): [ERROR:flutter/runtime/runtime_controller.cc(389)] Could not create root isolate.
E/flutter (18287): [ERROR:flutter/shell/common/shell.cc(605)] Could not launch engine with configuration.

the problem just in the mode release, but in the mode debug the plugin is working normally.

More details:

[✓] Flutter (Channel master, 3.4.0-36.0.pre.8, on Ubuntu 22.04.1 LTS 5.15.0-48-generic, locale en_US.UTF-8) Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] Android Studio (version 2021.3)
[✓] Android Studio
[✓] VS Code
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Thank you.


Solution

  • add @pragma('vm:entry-point') to background entry-point function