Skip to main content

Cloud Firestore

Notice

This page is archived and might not reflect the latest version of the FlutterFire plugins. You can find the latest information on firebase.google.com:

What does it do?#

Firestore is a flexible, scalable NoSQL cloud database to store and sync data. It keeps your data in sync across client apps through realtime listeners and offers offline support so you can build responsive apps that work regardless of network latency or Internet connectivity.

Installation#

1. Make sure to initialize Firebase#

Follow this guide to install firebase_core and initialize Firebase if you haven't already.

2. Add dependency#

On the root of your Flutter project, run the following command to install the plugin:

flutter pub add cloud_firestore

3. Rebuild your app#

Once complete, rebuild your Flutter application:

flutter run

4. (optional) Improve iOS & macOS build times#

Currently, the Firestore iOS SDK depends on some 500k lines of mostly C++ code which can take upwards of 5 minutes to build in Xcode. To reduce build times significantly, you can use a pre-compiled version by adding 1 line to your ios/Podfile inside your Flutter project;

pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => '8.15.0'

Add this line inside your target 'Runner' do block in your Podfile, e.g.:

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

Additionally, ensure that you have upgraded your cocoapods to 1.9.1 or higher: gem install cocoapods

For more information see this issue: https://github.com/FirebaseExtended/flutterfire/issues/2751

Next Steps#

Once installed, you're ready to start using Cloud Firestore in your Flutter Project. View the Usage documentation to get started.