Issue with Flutter stating that CocoaPods is either not installed or in an invalid state

Verify CocoaPods Installation

Run the following command to check if CocoaPods is installed on your system:

pod --version


If CocoaPods isn't installed, use the command below to install it:

sudo gem install cocoapods


Update CocoaPods

If CocoaPods is outdated or misconfigured, update it using:

sudo gem install cocoapods --pre
pod setup


This ensures you have the latest version and proper setup.


Install CocoaPods in Your Flutter Project

Navigate to your Flutter project’s iOS directory and install dependencies:

cd ios
pod install


If you run into issues, update the local pod repository with:

pod repo update


Clean Your Flutter Project

Clear the Flutter cache and re-fetch dependencies:

flutter clean
flutter pub get


Then, reinstall iOS dependencies:

cd ios
pod install


Update Xcode Command-Line Tools

Ensure Xcode and its command-line tools are up-to-date by running:

sudo xcode-select --install


Run Flutter Doctor for Diagnostics

Run Flutter Doctor to check your system setup for any other issues:

flutter doctor


Follow any recommendations to fix potential problems.