How to fix 'No such module Flutter' Error in Xcode

Published on

Have you encountered the frustrating "No such module 'Flutter'" error in Xcode while working on your Flutter iOS project? You're not alone! While Flutter makes it incredibly easy to write cross-platform apps, diving into the native iOS side can sometimes throw a curveball. This error often pops up when you open the generated iOS folder in Xcode, particularly when trying to interact with Flutter-specific code.

But don't worry, this seemingly complex issue has a straightforward solution. This guide will walk you through the exact steps to resolve the "No such module 'Flutter'" error and get back to building your amazing app.

Understanding the Problem

You might be able to call native iOS methods from your Flutter code without issues. However, when you open the ios folder in Xcode and look at files like AppDelegate.swift, you might see the red "No such module 'Flutter'" error, especially on import statements or when referencing Flutter-specific classes like FlutterViewController.

flutter iOS Xcode module not found error screenshot

What does this mean? Essentially, Xcode isn't correctly recognizing the Flutter framework within your iOS project's build configuration. This can prevent you from easily writing or navigating Flutter-related code within the Xcode environment, even if the project might still technically compile.

The Simple Solution: Linking the Flutter Framework

The fix involves explicitly linking the Flutter framework to your iOS project target in Xcode. Here's how to do it:

Xcode framework section

Reveal the Flutter Framework in Finder:

In this folder, you will find a file named Flutter.xcframework.

Drag and Drop Flutter.xcframework to Xcode:

Verify Embedding:

Once you drop the framework, Xcode will add it to the list. Ensure that the "Embed" column for Flutter.xcframework is set to "Do not Embed". This will ensure that the framework is linked correctly without embedding it multiple times.

Clean and Build Your Project: In Xcode, go to the "Product" menu, then select "Clean Build Folder..." (or use the shortcut Shift + Command + K). After cleaning, go to "Product" -> "Build" (or Command + B).

The Result: No More Error!

Once the build process completes successfully, the "No such module 'Flutter'" error should be gone from your AppDelegate.swift and other native iOS files where you might be using Flutter-related code. Xcode will now recognize the Flutter framework, allowing for better code completion and navigation.

You can use this solution to fix the same error writing native plugins for Flutter.

Additional Tips

Note that Pod install will be deprecated in the future. Swift Package Manager is the new way to manage dependencies in Flutter and iOS projects.

Why Did This Happen?

This error typically occurs because Xcode needs explicit instructions on where to find the Flutter framework. By dragging and dropping the Flutter.xcframework into the "Frameworks, Libraries, and Embedded Content" section, you are telling Xcode to include and link this framework during the build process.

Conclusion

Dealing with build errors can be a frustrating part of development. However, the "No such module 'Flutter'" error in Xcode is usually a simple fix. By following these steps to link the Flutter framework, you can ensure a smoother development experience when working with Flutter and native iOS code.

Now you can confidently write and navigate your Flutter-integrated iOS project in Xcode without that pesky error getting in your way. Happy coding!

Create a 5 stars app using our Flutter templates

Check our flutter boilerplate
kickstarter for flutter apps
Read more
You may also be interested in
Our Flutter Template is Here!  blog card image
Our Flutter Template is Here!
Published on 2023-10-10
Flutter theme made easy  blog card image
Flutter theme made easy
Published on 2023-10-23
ApparenceKit is a flutter template generator tool by Apparence.io © 2025.
All rights reserved