Hi,
I need your opinion about an issue we faced while trying to implement an iOS widget in our Flutter app.
Here is what we did and the problems we encountered:
We created a Widget Extension (SwiftUI + WidgetKit) inside the existing Flutter iOS project.
The widget files were generated correctly (Widget.swift, WidgetBundle.swift, Info.plist, etc.).
However, during the integration, we faced multiple issues:
Build Cycle Error
We repeatedly got:
“Cycle inside Runner; building could produce unreliable results”
This was related to embedding the widget extension into the Runner target.
Embed Problems
Sometimes Xcode did not automatically create the “Embed App Extensions” phase.
When we added it manually → build cycle errors appeared.
When we removed it → the widget was not embedded at all (no PlugIns folder in Runner.app).
Duplicate / Conflicting Embed
The extension appeared both in:
“Embed Foundation Extensions”
“Frameworks, Libraries, and Embedded Content”
Removing one often broke the build or removed the other as well.
Widget Not Appearing
Even when build succeeded:
Widget did not appear on device
PlugIns/Widget.appex was missing from build output
Flutter Linking Errors
In another test project, we got:
Undefined symbol: _FlutterMethodChannel
Undefined symbol: _FlutterBasicMessageChannel
etc.
This happened because the widget extension tried to link Flutter dependencies, which should not happen.
App Group Confusion
We also tried adding App Group (group.com.xxx), but behavior didn’t change.
Conclusion:
We suspect the root issue is:
The Flutter template we are using was not designed for WidgetKit integration
Xcode embedding phases and Flutter build scripts conflict with extension targets
Question:
In your opinion:
Is this a known limitation with Flutter-based iOS projects?
Is there a clean way to integrate WidgetKit without breaking the Runner target?
Or is it better to create a separate native iOS module for the widget?
Any guidance would be really appreciated.
Thanks!
0
0
16