samples
samples copied to clipboard
[add-to-app] Cannot re-open Flutter screen after multiple transitions between iOS native and Flutter
Steps to Reproduce
- Launch the fullscreen app.
- Tap "Launch Flutter ViewController" to open the Flutter screen.
- Tap "Exit this screen" to close the Flutter screen.
- Repeat steps 2 and 3.
- 💥Tap "Launch Flutter ViewController", but the Flutter screen does not appear.
https://github.com/user-attachments/assets/9f3a406f-4380-4fb7-a633-222a19243fb6
Environment
Flutter: 3.32.4 Xcode: 16.4 iOS Simulator: iPhone 16 (iOS 18.5)
Additional Information
- The following message is logged when attempting to transition to the Flutter screen, even if the transition appears successful.
[ERROR:flutter/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm(183)] The supplied FlutterEngine <FlutterEngine: 0x104807470> is already used with FlutterViewController instance <FlutterViewController: 0x10e808600>. One instance of the FlutterEngine can only be attached to one FlutterViewController at a time. Set FlutterEngine.viewController to nil before attaching it to another FlutterViewController. - Also appeared in the plugin app and an app built following the official guide.
- The number of transitions before the issue appears varies.
- Not appeared in the multiple_flutters app.
- I think setting
flutterEngine.viewController = nilon Flutter screen dismissal would solve the problem, but I don't know if this is the right or recommended solution.
Same issue here, Waiting for comments!
Same issue
This issue mentioned here https://github.com/flutter/flutter/issues/172105