Repository: flutter
Issue: Issue running `FlutterEngine.runWithEntrypoint:libraryURI:` pointing to package
Labels: c: new feature,platform-ios,tool,engine,a: existing-apps,t: xcode,P2,team-ios,triaged-ios

### Steps to reproduce

1. Create a Flutter project
2. Create a flutter project (here "sub_project") under `/packages` directory so that your project structure looks like this:
```
main_project/
├─ ios/
├─ android/
├─ lib/
│  ├─ main.dart
├─ packages/
│  ├─ sub_project/
│  │  ├─ lib/
│  │  │  ├─ main.dart
│  │  ├─ ios/
│  │  ├─ android/
```
3. From Xcode, create engine running in "sub_project" library, create FlutterViewController from said engine, and set this view controller as the root in in your Runner's SceneDelegate like so:
```swift
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    
    var window: UIWindow?
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowScene = (scene as? UIWindowScene) else { return }
        window = UIWindow(windowScene: windowScene)
        setInitialViewController()
        window?.makeKeyAndVisible()
    }
    
    
    func setInitialViewController()  {
        let engine = FlutterEngine()
        engine.run(withEntrypoint: "main", libraryURI: "package:sub_project/main.dart")
        let vc = FlutterViewController(engine: engine, nibName: nil, bundle: nil)
        let nav = UINavigationController(rootViewController: vc)
        nav.isNavigationBarHidden = true
        window?.rootViewController = nav
    }

    ...

}
```
4. Launch app from Xcode

### Actual results

We would expect the sub_project to be displayed within the root `FlutterViewController`, but instead we are receiving the following error: `[ERROR:flutter/shell/common/shell.cc(114)] Dart Error: Dart_LookupLibrary: library 'package:sub_project/main.dart' not found.`

Clearly, we are not using `FlutterEngine.runWithEntrypoint:libraryURI:` correctly. Is it possible to use this method to launch code that lives outside of `main_project/lib`, i.e. at `main_project/packages/sub_project`?

### Logs

`[ERROR:flutter/shell/common/shell.cc(114)] Dart Error: Dart_LookupLibrary: library 'package:sub_project/main.dart' not found.`

[flutter/shell/common/shell.cc](https://github.com/flutter/engine/blob/f40e976bedff57e69e1b3d89a7c2a3c617a03dad/shell/common/shell.cc#L114) for flutter/engine tag 3.16.9

### Flutter Doctor output

<details open>
<summary>Doctor output</summary>

```console
[!] Flutter (Channel [user-branch], 3.16.9, on macOS 13.6.2 22G320
    darwin-arm64, locale en-US)
    ! Flutter version 3.16.9 on channel [user-branch] at
      /Users/chopind/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an
      official channel.
      If that doesn't fix the issue, reinstall Flutter by following
      instructions at https://flutter.dev/docs/get-started/install.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to
      dismiss this error.
    • Framework revision 41456452f2 (5 weeks ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5
    • If those were intentional, you can disregard the above warnings;
      however it is recommended to use "git" directly to perform update
      checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.0)
    • Android SDK at /Users/chopind/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15C500b
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[✓] VS Code (version 1.70.0)
    • VS Code at /Users/chopind/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554                        •
      android-arm64  • Android 13 (API 33) (emulator)
    • iPhone 15 Pro (mobile)      • 667FA1B3-107C-416E-A6B5-2CD4422BAEEA •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-2
      (simulator)
    • macOS (desktop)             • macos                                •
      darwin-arm64   • macOS 13.6.2 22G320 darwin-arm64
    • Chrome (web)                • chrome                               •
      web-javascript • Google Chrome 122.0.6261.69

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>