Flutter: Understanding pods vs dependencies

Viewed 519

I'm new to flutter, so sorry about the basic question, I just couldn't find the answer through searching.

In the flutter project, in the pubspec.yaml file there are dependancies. For example, I am using:

firebase_auth: ^0.18.3
cloud_firestore: ^0.14.3

Now, coming from ios development, I used to add into my podfile these:

pod 'Firebase/Auth'
pod 'Firebase/Firestore'

Now, in flutter, is it enough to add them as dependancies in the pubspec.yaml, without adding them in the podfile. I am confused, because I have read in some tutorials you need to add things to the pod file, and then run pod install. So when do you need the pods, and when can you rely on the pubspec.

The same question applies to the the android build.grade dependancies.

Thanks

1 Answers

I think your question can be answered by the Handling package interdependencies section of the plugin development documentation.

firebase_auth and cloud_firestore are both plugin packages, meaning that they work with platform-specific APIs under the hood.

On iOS, each plugin has its own podspec file that tells Cocoapods what Pods need to be downloaded for the plugin to work properly.

Long story short, plugin packages maked sure you don't have to add the dependencies to your Podfile.

Keep in mind, not all packages need to communicate with the Platform. A plugin like simple_animations, or provider, will only work with the Flutter API, so they don't install any pods or dependencies.

But there are times when you may need to edit your Podfile manually, like when you need to change the supported platform, or add additional information about a plugin.

Related