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.
Build Flutter Apps Fast. Build an end-to-end Flutter + Firebase app using FlutterFlow and download the code or deploy directly to the app stores. Click to view our new development playground.
To take advantage of this, follow these two steps:
You can do so by opening the
ios/Podfile.lock and searching for
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).
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! 😎