In the last blog post, I wrote about how flutter includes all the platform-specific implementations in the dependency tree even when you don’t target those platforms. Thus causing unnecessary dependency conflicts. In this post, I will show another annoying issue about how flutter handles native dependencies, particular in iOS.
If you add the following packages in your project and do a flutter pub get
:
It will resolve successfully and even run perfectly on android. But when you try to build for iOS you will get the following error:
What’s happening here is that both the packages depend on a different major versions of native FBSDKCoreKit
CocoaPod (The native facebook iOS SDK). Since flutter is only resolving the dart dependencies, it didn’t even know about the dependency conflict in the native packages. If a package updates the major versions of a native dependency in a minor/patch update, such issues may break your builds the next time you run flutter pub upgrade