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.

The Complete Dart Developer Guide

The Complete Dart Developer Guide

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

Flutter Animations Masterclass - Full Course

Flutter Animations Masterclass - Full Course

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

Flutter & Firebase Course: Build a Complete App for iOS & Android

Flutter & Firebase Course: Build a Complete App for iOS & Android

A full course with in-depth content, taking you from the basics all the way up to more advanced topics.

Flutter REST API Crash Course

Flutter REST API Crash Course

Build a Coronavirus Tracking App, and learn how to use REST APIs in Flutter.

Get the best Flutter tutorials, right in your inbox.

Join over 16,000 developers who receive my weekly Flutter email course & newsletter:

No spam, ever. Unsubscribe at any time.