How to fix the “module Flutter not found” compiler error in Xcode

Ademola (Fadumo) Babs-Samuel
2 min readOct 25, 2023

--

Every time I opened the native iOS module in all my flutter projects I kept on coming across this error “module Flutter not found” compiler error in Xcode.

Earlier this year, I started deep diving into iOS development and working with packages mostly using Carthage.

Carthage is a simple, decentralized dependency manager for Cocoa.

The way Carthage works you’d have to build your dependencies and manually add the generated binary frameworks i.e. a “.xcframework” folder into your iOS projects.

I started researching on stack overflow with possible solutions to try to fix this issue and came across one solution (had no upvotes apparently) which pointed to a possible fix https://stackoverflow.com/a/76168473/15242409.

This generates a Flutter.xcframework folder which you can then add to your project.

I did something different with what I already knew which was to use the Flutter.xcframework folder located in the main Flutter project itself.

Solution

Step 1: Locate the Flutter.xcframework in your main Flutter dev project.

Go into your Flutter dev folder, find the bin folder in the root directory and navigate to => bin => cache => artifacts => engine => ios

You can then use the Flutter.xcframework by embedding it into your “Runner” under Targets

Step 2: Add the Flutter.xcframework to your iOS project.

Go into the iOS module of your flutter project, find “Runner” under Targets.

Find the section “Frameworks, Libraries and Embedded Content” by scrolling up.

Drag and drop the build “Flutter.xcframework” into the list, this is similar to how you add modules in Carthage to your iOS projects.

Set the embed option to “Do Not Embed” to avoid bundling your app with it as the flutter system already handles this.

We’re doing this just so we can have auto complete from the flutter framework while working natively in the iOS module.

Step 3: Clean build and rebuild, the module not found error should no longer be present.

This feels more like a temporary fix but for now I can use the auto complete from the Flutter framework within Xcode.

Sign up to discover human stories that deepen your understanding of the world.

--

--

Ademola (Fadumo) Babs-Samuel
Ademola (Fadumo) Babs-Samuel

Written by Ademola (Fadumo) Babs-Samuel

A Software Engineer with expertise in mobile application development using Flutter & Native iOS.

No responses yet

Write a response