Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why file not found when I invoke runWithEntrypoint:libraryURI: on a FlutterEngine?

I try to specify an entrypoint function in a specific file to launch a Flutter screen from my iOS APP, I follow the doc but get an error:

Dart Error: Dart_LookupLibrary: library 'hh.dart' not found.

This is my code in Xcode:

flutterEngine.run(withEntrypoint: "hhPage", libraryURI: "hh.dart")

and partial directory structure in the flutter module:

lib/
├─ main.dart
└─ hh.dart
like image 887
Outlaw Zhangsan Avatar asked Oct 20 '25 03:10

Outlaw Zhangsan


1 Answers

The doc is not correct or out of date. According to the doc comment of libraryURI argument, we need to specify a string including its package name, like "package:your_package/hh.dart".

flutterEngine.run(withEntrypoint: "hhPage", libraryURI: "package:your_package_name/hh.dart")

Additionally, hh.dart has to be imported in main.dart to contain the file in the app.

like image 73
scenee Avatar answered Oct 22 '25 05:10

scenee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!