Search code examples
iosfirebasecocoapodsflutter-ios

How do I remove Cocoapod pods from a Flutter project?


I have a Flutter app that runs fine on Android devices. It has a Firebase Firestore backend.

Now, I want to build it on an iOS simulator, and so I need to initialize the Firebase iOS app. (I had only initialized the Android version before.) So I tried following the steps on firebase.com for setting up the iOS Firebase app using Cocoapods... but I think I did something wrong! More specifically, I believe the steps I followed were for adding Firebase to a native iOS app (in Objective C or similar), but when using Flutter, I'm supposed to let the Flutter framework do most of this work, rather than adding pods manually! (Here's a specific instruction for adding Firebase to a Flutter iOS project)

But before doing it right, I want to remove the pods that Cocoapods installed for me. Only I don't know how! šŸ˜£ When I web-search, I'm told to delete the pods I don't want from the Podfile. Only there ARE no pods in my ios/Podfile! There's only a bit that says:

target 'Runner' do
  use_frameworks!
  use_modular_headers!

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

There's also an ios/Podfile.lock file, and THAT one has a list of all the pods... And then, there's an ios/Pods/Manifest.lock file, which also has such a list... So should I delete the unwanted pod names from one of these two files, instead?

Or otherwise, how do I uninstall my Cocoapods pods, when they are not listed in the ios/Podfile?


Solution

  • Turns out the correct way to install and remove pods from a Flutter project is just to edit the pubspec.yaml file in the root directory!

    Cocoapods needs to be installed, but it will automatically read the pubspec.yaml file and do the work from there! šŸ™‚ No need to run pod commands from terminal or otherwise.