Speed up the iOS build of a Flutter app using Firestore slightly

Introduction

When developing with Flutter, it’s common for iOS builds to be slow. However, when you start using Firestore, the build becomes even slower. I wanted to improve this, and it seemed that using the following tool could help reduce build time:

According to the README, Firestore’s iOS SDK has 500,000 lines of C++ code, which takes time to compile. This tool provides precompiled Firestore iOS SDK xcframework files, which should help speed up the build process.

Installation

The installation is easy; simply add the following line to the target 'Runner' block in the ios/Podfile:

target 'Runner' do
  # Add the following code
  pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '9.4.0'

  use_frameworks!
  use_modular_headers!

  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

You’ll need to adjust the :tag => '9.4.0' part according to the Firebase/Firestore version you are using. If the version does not match, you’ll get a build error, so you can specify the version that appears in the error message.

The supported Firebase iOS SDK versions are listed in the README:

Conclusion

After trying it out myself, the Xcode build on the CI went from 600 seconds to 450 seconds.

As the title says, it’s “slightly” faster.

Related Posts