Swift Compiler Error (Xcode): No such module 'Flutter' sqflite_darwin-include-sqflite_darwin-SqfliteImportPublic.h

Created At: 2025-04-30 04:25:21 Updated At: 2025-04-30 06:17:53

This is a tedious problem, it may take hours to solve it. I have tried many diferent approaches. I will tell you what I tried and what worked eventually. 

The reason why happens due to x-code version update. I updated my x-code to 16.2. To check your xcode version use xcodebuild -version.

But since I have tried many different approaches, some of the earlier appraoches may have effected the later approaches. 

So you may need to try all of the efforts. 

I was facing two problems at the same time. First one was fluter.h header file is not found as

Swift Compiler Error (Xcode): No such module 'Flutter'

This is due to xcode update. Then I also faced another problem related to sqflite, more specificly sqflitepluginpublic.h as 

'include/sqflite_darwin/sqflitepluginpublic.h' file not found

Now the above two problems appeared in one line. Now to solve the problems I have tried the following steps.

Classic steps

Well, as they do it all the time, I have tried below steps

  1. rm ios/Podfile.lock

  2. rm -rf ios/.symlinks

  3. rm -rf ios/Pods

  4. flutter clean

  5. flutter pub get

  6. cd ios

  7. arch -x86_64 pod instal (for M1/M2) users

  8. pod deintegrate && pod install --repo-update

I have tried the above the steps many times along with

sudo rm -rf ~/Library/Developer/Xcode/DerivedData/; sudo rm -rf ~/Library/Caches/

and then I have also changed the Podfile. 

I have also tried to downgrade xcode project using xcodeproj --version. I found out it was 1.27.0. According to some github link I needed to downgrade this. 

  1. gem uninstall xcodeproj
  2. gem install xcodeproj --version=1.25.0

So here first I have uninstalled xcodeproj and reinstalled of version of 1.25.0. But eventaully this did not help either. So at the end I stuck for a long time. Along the way I was also using ChatGPT and other AI related tools to get help. 

One of the tools also suggested to do this 

Now it was prompting this again and again. But I did not want to do out of laziness.  Now since nothing was working, then I went along did so.

Even after that it did not work. Then again I tried the below steps one by one 

  1. rm -rf ~/Library/Developer/Xcode/DerivedData
  2. rm -rf ios/Podfile.lock ios/Pods ios/.symlinks
  3. sudo gem uninstall cocoapods
  4. brew uninstall cocoapods
  5. sudo gem install cocoapods

And then this on the xcode 

  1. $(inherited)
  2. $(FLUTTER_ROOT)/.ios/Flutter
  3. ${PODS_ROOT}/Flutter
  4. ${PODS_ROOT}/../Flutter

Then I also had my Podfile like this

# Uncomment this line to define a global platform for your project

platform :ios, '14.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.

ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {

  'Debug' => :debug,

  'Profile' => :release,

  'Release' => :release,

}

def flutter_root

  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)

  unless File.exist?(generated_xcode_build_settings_path)

    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"

  end

  File.foreach(generated_xcode_build_settings_path) do |line|

    matches = line.match(/FLUTTER_ROOT\=(.*)/)

    return matches[1].strip if matches

  end

  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"

end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do

  use_frameworks!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))

  target 'RunnerTests' do

    inherit! :search_paths

  end

end

post_install do |installer|

  installer.pods_project.targets.each do |target|

    flutter_additional_ios_build_settings(target)

  end

end

And then I found my project built successfully. 

The real challenge was that multiple issues overlapped, and trying different fixes influenced the behavior. So while some steps alone may not help, the right combination eventually does the job.

If you’re stuck, I suggest following the clean reinstall of CocoaPods, making sure your Xcode version is known to work with Flutter, and carefully checking your Podfile and build settings. Now the xcode build settings is a must, if you skip this it won't work.

Flutter Multi Vendor App

Flutter Single Vendor App

Comment

Add Reviews

1
Chat With Us