Repository: flutter
Issue: Import flutter module to IOS app native error MissingPluginException
Labels: platform-ios,engine,a: existing-apps,has reproducible steps,P3,found in release: 3.10,team-ios,triaged-ios,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [x] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

1. Make a Flutter plugin and put it as dependency in a new Flutter module
2. using path_provider and quick_blue packages
3. add2app using option A https://docs.flutter.dev/add-to-app/ios/project-setup 
4. the module functions are working fine except:
5. when call functions from path_provider or quick_blue it got errors only in IOS

### Expected results

I hope the integration work like when using android native

### Actual results

error for path_provider:
`2023-08-14 18:55:57.089106+0800 MyApplicationIOS[22851:4442097] flutter: PlatformException(channel-error, Unable to establish connection on channel., null, null)
2023-08-14 18:55:57.089232+0800 MyApplicationIOS[22851:4442097] flutter: #0      PathProviderApi.getDirectoryPath (package:path_provider_foundation/messages.g.dart:40:7)
<asynchronous suspension>
#1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
<asynchronous suspension>
#2      CmdCommonFun.writeFiletoRoot (package:tptaq_bms_util_plugin/tp_bms_lib/read_config/common_fun.dart:118:19)
<asynchronous suspension>`

error for quick_blue:
`Unhandled Exception: MissingPluginException(No implementation found for method stopScan on channel quick_blue/method)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
<asynchronous suspension>
#1      MethodChannelQuickBlue.stopScan.<anonymous closure> (package:quick_blue_platform_interface/method_channel_quick_blue.dart:44:15)
<asynchronous suspension>`

### Code sample

<details><summary>Code sample</summary>
ios code
```

import UIKit
import tptaq_bms_util_plugin
import Flutter
import FlutterPluginRegistrant
import quick_blue
import path_provider_foundation

class ViewController: UIViewController, ObservableObject {
    
    let flutterEngine = FlutterEngine(name: "tptaq_bms_util_channel")
    var TPBMSPlugin: TptaqBmsUtilPlugin?

    
    @IBOutlet weak var bleDataLabel: UILabel!
    
    @IBAction func stopDiagnosisButton(_ sender: UIButton) {
        
            TPBMSPlugin!.stopDiagnosis()
                                 }
    @IBAction func fwUpdateButton(_ sender: UIButton) {
    }
    @IBAction func diagnosisButton(_ sender: UIButton) {
        TPBMSPlugin!.BMSDiagnosis(deviceName: "TPF004", username: "trendpower", password: "1234") { (result: Dictionary<String, Any>) in
                   // do stuff with the result
                   self.bleDataLabel.text = "\(result)"
               }
    }
    override func viewDidLoad() {
        
            flutterEngine.run()
        let registrar = flutterEngine.registrar(forPlugin: "tptaqBmsUtilModule")
        TPBMSPlugin = TptaqBmsUtilPlugin(registrar: registrar!)
        super.viewDidLoad()
        
        // Do any additional setup after loading the view.
    }
```

```
public class TptaqBmsUtilPlugin: NSObject, FlutterPlugin {
    
    var channel: FlutterMethodChannel
    
    public init(registrar: FlutterPluginRegistrar) {
        channel = FlutterMethodChannel(name: "tptaq_bms_util_channel", binaryMessenger: registrar.messenger())
        super.init()
        registrar.addMethodCallDelegate(self, channel: channel)
    }
    
    public static func register(with registrar: FlutterPluginRegistrar) {
        _ = TptaqBmsUtilPlugin(registrar: registrar)
    }
    public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
        result("iOS " + UIDevice.current.systemVersion)
    }
```
```my flutter module pubspec.yaml
version: 1.0.0+1

environment:
  sdk: '>=2.19.6 <3.0.0'

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  tptaq_bms_util_plugin:
    path: tptaq_bms_util_plugin
    
  path_provider: ^2.1.0
  convert: ^3.0.0
  decimal: ^2.3.3
  intl: ^0.18.1
  
dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  module:
    androidX: true
    androidPackage: com.tp.tptaq_bms_util_module
    iosBundleIdentifier: com.tp.tptaqBmsUtilModule

```
```my flutter plugin pubspec.yaml
description: A new Flutter plugin project.
version: 0.0.1
homepage:

environment:
  sdk: '>=2.19.6 <3.0.0'
  flutter: ">=2.5.0"

dependencies:
  flutter:
    sdk: flutter
  # tptaq_bms_util: 
  #   path: ../tptaq_bms_util

  quick_blue: 
    path: ../quick_blue
  plugin_platform_interface: ^2.0.2
  path_provider: ^2.1.0
  convert: ^3.0.0
  decimal: ^2.3.3
  intl: ^0.18.1


dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
  # This section identifies this Flutter project as a plugin project.
  # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
  # which should be registered in the plugin registry. This is required for
  # using method channels.
  # The Android 'package' specifies package in which the registered class is.
  # This is required for using method channels on Android.
  # The 'ffiPlugin' specifies that native code should be built and bundled.
  # This is required for using `dart:ffi`.
  # All these are used by the tooling to maintain consistency when
  # adding or updating assets for this project.
  plugin:
    platforms:
      android:
        package: com.example.tptaq_bms_util_plugin
        pluginClass: TptaqBmsUtilPlugin
      ios:
        pluginClass: TptaqBmsUtilPlugin
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console

2023-08-14 18:55:57.089106+0800 MyApplicationIOS[22851:4442097] flutter: PlatformException(channel-error, Unable to establish connection on channel., null, null)
2023-08-14 18:55:57.089232+0800 MyApplicationIOS[22851:4442097] flutter: #0      PathProviderApi.getDirectoryPath (package:path_provider_foundation/messages.g.dart:40:7)
<asynchronous suspension>
#1      getApplicationDocumentsDirectory (package:path_provider/path_provider.dart:121:24)
<asynchronous suspension>
#2      CmdCommonFun.writeFiletoRoot (package:tptaq_bms_util_plugin/tp_bms_lib/read_config/common_fun.dart:118:19)
<asynchronous suspension>
2023-08-14 18:55:57.090702+0800 MyApplicationIOS[22851:4442097] [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method startScan on channel quick_blue/method)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
<asynchronous suspension>
#1      MethodChannelQuickBlue.startScan.<anonymous closure> (package:quick_blue_platform_interface/method_channel_quick_blue.dart:38:15)
<asynchronous suspension>
2023-08-14 18:56:02.093186+0800 MyApplicationIOS[22851:4442097] flutter: []
2023-08-14 18:56:02.094234+0800 MyApplicationIOS[22851:4442097] [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method stopScan on channel quick_blue/method)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7)
<asynchronous suspension>
#1      MethodChannelQuickBlue.stopScan.<anonymous closure> (package:quick_blue_platform_interface/method_channel_quick_blue.dart:44:15)
<asynchronous suspension>
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.14.0-3.0.pre.58, on macOS 13.4.1 22F770820d
    darwin-arm64, locale en-TW)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Community Edition (version 2022.1.2)
[✓] VS Code (version 1.68.0)
[✓] Connected device (4 available)
[✓] Network resources


```

</details>