Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/content/add-to-app/ios/add-flutter-screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaaclarke is this right? The libraryURI should be package:your_package_name/other_file.dart?

flutter/engine#30726

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like advice that will not apply to everyone. So at a bare minimum it should be an added note instead of modifying the prevailing guidance.

In order to change the guidance I'd like to see a bug issued. In order to add the note I'd like to see an example project that demonstrates it's correctness.

```

{% endtab %}
{% tab "Objective-C" %}

```objc
[flutterEngine runWithEntrypoint:@"myOtherEntrypoint" libraryURI:@"other_file.dart"];
[flutterEngine runWithEntrypoint:@"myOtherEntrypoint" libraryURI:@"package:your_package_name/other_file.dart"];
```

{% endtab %}
Expand Down
Loading