error 'Flutter/Flutter.h' file not found when flutter run on iOS
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
The error Flutter/Flutter.h file not found usually means the iOS side of a Flutter project is not resolving the generated Flutter framework through CocoaPods or the expected workspace files. The message looks like a compiler problem, but the root cause is typically build setup, not missing source code. In practice, the fix is to restore the generated iOS artifacts and make sure Xcode is opening the workspace that CocoaPods created.
What the Error Usually Means
On iOS, Flutter integrates native build settings, generated files, and CocoaPods-managed dependencies. If any part of that chain is stale or skipped, Xcode cannot find the Flutter headers during compilation.
Common causes include:
- opening
Runner.xcodeprojinstead ofRunner.xcworkspace - not running
pod install - stale
PodsorPodfile.lockfiles after SDK changes - a broken generated
.iosorFlutterfolder in module-style projects - local environment issues with CocoaPods or Xcode command-line tools
The path to recovery is usually the same regardless of which of those caused the failure.
Standard Repair Flow
Start from the Flutter project root and regenerate the iOS build state:
If CocoaPods reports an error, fix that first. The header problem often disappears once pods are installed correctly.
When opening the project manually in Xcode, use the workspace:
If you open Runner.xcodeproj, Xcode does not load the CocoaPods integration, which is one of the most common reasons Flutter/Flutter.h appears missing.
Resetting Broken iOS Artifacts
If the standard flow does not work, clear out iOS dependency artifacts and reinstall them:
This is useful after:
- upgrading Flutter
- changing plugin versions
- switching Xcode versions
- pulling a branch with inconsistent generated files
For add-to-app or module setups, regenerate the platform-specific artifacts if needed:
In some project layouts, the generated Flutter files are not committed and must be recreated locally.
Verifying the iOS Toolchain
Sometimes the real problem is the local toolchain rather than the project itself. Run:
Pay close attention to:
- Xcode installation status
- CocoaPods availability
- accepted Xcode license
- iOS simulator and command-line tools configuration
If CocoaPods is missing or broken, reinstalling it can unblock the build. On many systems:
If your environment uses Homebrew or another Ruby setup, use the installation method already standard for that machine.
Xcode Build Settings to Check
If the project still fails inside Xcode after pods install successfully, inspect a few integration points:
- '
ios/Flutter/Generated.xcconfigshould exist.' - The Pod targets should appear in the workspace.
- '
Podfileshould not contain accidental manual edits that removed Flutter integration.' - Custom header search path changes should be treated with suspicion.
A simple Podfile for a normal Flutter app should leave most Flutter-generated wiring alone. If someone manually modified pod targets or build settings, compare against a fresh Flutter project.
When the Error Happens in CI
CI builds often fail with this message when the workflow skips flutter pub get, does not run CocoaPods, or caches stale pod directories across Flutter upgrades. Make sure the pipeline performs the same setup a local machine needs.
The important part is that CI should build the workspace, not the plain project file.
Common Pitfalls
The biggest mistake is opening Runner.xcodeproj instead of Runner.xcworkspace. That bypasses the pod integration entirely.
Another common issue is running flutter clean and flutter pub get but forgetting pod install. Flutter regenerates Dart-side artifacts, but iOS pods still need to be resolved.
Developers also sometimes delete parts of the ios/Flutter directory manually. Those generated files are part of the build chain and should usually be recreated by Flutter rather than hand-edited.
Finally, be careful with old caches after upgrading Flutter or Xcode. A stale pod setup can survive longer than expected and keep reproducing the same header error.
Summary
- '
Flutter/Flutter.herrors usually point to broken iOS integration, not a missing source file.' - Run
flutter clean,flutter pub get, andpod installbefore deeper debugging. - Open
ios/Runner.xcworkspace, notRunner.xcodeproj. - If needed, remove
PodsandPodfile.lockand reinstall dependencies. - Check
flutter doctor -vand verify the local CocoaPods and Xcode setup.
Related reading
- Error in launching AVD with AMD processor
- Error in Swift class Property not initialized at super.init call
- ERROR ITMS-9000 Redundant Binary Upload. There already exists a binary upload with build version '1.0' for train '1.0
- Error itms-90035 - Xcode
- Error forwarding ports error upgrading connection Upgrade request required
- Error found in Chart.yaml, but missing in charts/ directory mysql
- ERROR ITMS-90164/90046 Invalid Code Signing Entitlements
- ERROR ITMS-90208 Invalid Bundle. The bundle your.app does not support the minimum OS Version specified in the Info.plist
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.