Flutter Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found

1.8k views Asked by At

I am using Home Screen Widget the package is here https://pub.dev/packages/home_widget/install

and with flutter run --release I get the following error Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found.

but I don't get any error in flutter run --profile and it works.

I cannot publish to the play store without running flutter run in --release mode. What should I do to prevent flutter run --release mode from giving an error?

Error code :

E/flutter (24125): [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:home_widget/home_widget_callback_dispatcher.dart' not found.
E/flutter (24125): [ERROR:flutter/runtime/dart_isolate.cc(668)] Could not resolve main entrypoint function.
E/flutter (24125): [ERROR:flutter/runtime/dart_isolate.cc(167)] Could not run the run main Dart entrypoint.
E/flutter (24125): [ERROR:flutter/runtime/runtime_controller.cc(385)] Could not create root isolate.
E/flutter (24125): [ERROR:flutter/shell/common/shell.cc(604)] Could not launch engine with configuration.

and Androidmanifest.xml :

<!-- Your Background receiver and service goes here -->
<receiver android:name="AppWidgetProvider" android:exported="true">
    <intent-filter>
        <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
    </intent-filter>
    <meta-data android:name="android.appwidget.provider"
        android:resource="@xml/widget_info" />
</receiver>

<receiver android:name="es.antonborri.home_widget.HomeWidgetBackgroundReceiver" android:exported="true">
    <intent-filter>
        <action android:name="es.antonborri.home_widget.action.BACKGROUND" />
    </intent-filter>
</receiver>

<service android:name="es.antonborri.home_widget.HomeWidgetBackgroundService"
    android:permission="android.permission.BIND_JOB_SERVICE" android:exported="true"/>

and pubspec.yaml :

home_widget: ^0.1.6
workmanager: ^0.5.1

and flutter doctor :

[√] Flutter (Channel stable, 3.3.9, on Microsoft Windows [Version 10.0.22623.1020], locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Enterprise 2022 17.0.4)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2021.2)
[√] Connected device (4 available)
[√] HTTP Host Availability

1

There are 1 answers

0
Ramazan HABER On BEST ANSWER

Add this code --> @pragma('vm:entry-point')

STEP 1:

Project -> External Libraries -> Dart Packages -> home_widget-0.1.6 -> home_widget_callback_dispatcher.dart

STEP 2:

See also:

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

Home Widget -> flutter run --release it is work I leave the application link below, you can test it https://play.google.com/store/apps/details?id=com.ramzey.bankadovizpro

Source Code:

https://www.roketnot.com/not/1608-home-screen-widget-kullanimi-telefonun-ana-ekranina-widget-koyma

Same problem:

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