How to speed-up Cloud Firestore Xcode builds on your Flutter apps

One long-standing issue with Cloud Firestore is that Flutter Xcode builds take a long time, especially on CI environments. This is because the Firestore iOS depends on 500k lines of mostly C++ code, that are compiled from scratch as part of the Xcode build.

Fortunately, a solution is now available and documented here:

To speed up your build times, you can use invertase/firestore-ios-sdk-frameworks, which contains precompiled Firestore iOS SDKs extracted from the Firebase iOS SDK release downloads.

To take advantage of this, follow these two steps:

1. Find which version of the Firestore iOS SDK is in use

You can do so by opening the ios/Podfile.lock and searching for cloud_firestore.

You should find something like this:

- cloud_firestore (3.1.4): - Firebase/Firestore (= 8.9.0) - firebase_core - Flutter

Make a note of the Firebase/Firestore version (8.9.0 in this case).

2. Use the precompiled Firestore iOS SDK

Open the Podfile inside the ios folder, then add this line inside your target 'Runner' do block:

target 'Runner' do pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.9.0' # ... end

Note: the first time you try this, you may get this error log:

[!] CocoaPods could not find compatible versions for pod "FirebaseFirestore": In snapshot (Podfile.lock): FirebaseFirestore (= 8.9.1, ~> 8.9.0) In Podfile: FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.9.0`) None of your spec sources contain a spec satisfying the dependencies: `FirebaseFirestore (from `https://github.com/invertase/firestore-ios-sdk-frameworks.git`, tag `8.9.0`), FirebaseFirestore (= 8.9.1, ~> 8.9.0)`. You have either: * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.

This is solved by removing ios/Podfile.lock and rebuilding.

You're welcome! 😎

Want More?

Invest in yourself with my high-quality Flutter courses.

Flutter In Production

Flutter In Production

Learn about flavors, environments, error monitoring, analytics, release management, CI/CD, and finally ship your Flutter apps to the stores. 🚀

Flutter Foundations Course

Flutter Foundations Course

Learn about State Management, App Architecture, Navigation, Testing, and much more by building a Flutter eCommerce app on iOS, Android, and web.

Flutter & Firebase Masterclass

Flutter & Firebase Masterclass

Learn about Firebase Auth, Cloud Firestore, Cloud Functions, Stripe payments, and much more by building a full-stack eCommerce app with Flutter & Firebase.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

Learn Dart Programming in depth. Includes: basic to advanced topics, exercises, and projects. Last updated to Dart 2.15.

Flutter Animations Masterclass

Flutter Animations Masterclass

Master Flutter animations and build a completely custom habit tracking application.