From 117aa72418c97b04477e9e2e51d82aa500f90c24 Mon Sep 17 00:00:00 2001 From: Joohyung Park Date: Mon, 30 Sep 2024 18:54:08 +0900 Subject: [PATCH] Update iOS flutterEngine libraryURI --- src/content/add-to-app/ios/add-flutter-screen.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/content/add-to-app/ios/add-flutter-screen.md b/src/content/add-to-app/ios/add-flutter-screen.md index 59020a42e84..ea2318c6ef0 100644 --- a/src/content/add-to-app/ios/add-flutter-screen.md +++ b/src/content/add-to-app/ios/add-flutter-screen.md @@ -646,6 +646,14 @@ not be [tree-shaken][] away when compiling: @pragma('vm:entry-point') void myOtherEntrypoint() { ... }; ``` + +Additionally, If your entrypoint functions are not in `lib/main.dart` file, +you need to import them in `lib/main.dart`. + +```dart +// ignore: unused_import +import 'package:your_package_name/other_file.dart'; +``` ::: ### Dart library @@ -660,14 +668,14 @@ in `lib/other_file.dart` instead of `main()` in `lib/main.dart`: {% tab "Swift" %} ```swift -flutterEngine.run(withEntrypoint: "myOtherEntrypoint", libraryURI: "other_file.dart") +flutterEngine.run(withEntrypoint: "myOtherEntrypoint", libraryURI: "package:your_package_name/other_file.dart") ``` {% endtab %} {% tab "Objective-C" %} ```objc -[flutterEngine runWithEntrypoint:@"myOtherEntrypoint" libraryURI:@"other_file.dart"]; +[flutterEngine runWithEntrypoint:@"myOtherEntrypoint" libraryURI:@"package:your_package_name/other_file.dart"]; ``` {% endtab %}