Search code examples
fluttercocoapods

How do you add a CocoaPod to a Flutter project?


Having a hard time finding any info on how to add a specific pod to my flutter project for iOS support. The Podfile is generated automatically, so doesn't seem like just adding it to the Podfile is the way to go. Or am I completely wrong and I should just update the Podfile and git add the Podfile and it's .lock file?


Solution

  • I think it depends on your specific case. As a general rule, I have not added files to the podfile, although I typically have to do a "podfile install" on repos that I've downloaded.

    However, when I've had to do it, it's always been to support firebase.

    I had to install firebase a number of months ago and had to add it to the podfile, and I think I saw this entry: Flutter Podfile and Firebase

    Perhaps it's still the case, because I found this tutorial, and step 4 indicates that the firebase SDK should be added to the podfile, and that article is dated late Dec, 2019: https://www.freecodecamp.org/news/how-to-integrate-your-ios-flutter-app-with-firebase-on-macos-6ad08e2714f0/

    So, I think the answer is "yes... but not usually"

    For that project, I had to add the podfile to the repo, and I've had to add build.gradle files as well, so I don't think it's out of place.