Skip to main content

Realtime Database

What does it do?#

The Firebase Realtime Database is a cloud-hosted database. Data is stored as JSON and synchronized in realtime to every connected client. When you build cross-platform apps Flutter & Firebase, all of your clients can share one Realtime Database instance and automatically receive updates with the newest data.

Installation#

1. Add dependency#

pubspec.yaml
dependencies:
flutter:
sdk: flutter
firebase_core: "^0.7.0"
firebase_database: "^6.0.0"

2. Download dependency#

$ flutter pub get

3. (Web Only) Add the SDK#

If using FlutterFire on the web, add the firebase-database JavaScript SDK to your index.html file:

web/index.html
<html>
...
<body>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-database.js"></script>
</body>
</html>

4. Rebuild your app#

Once complete, rebuild your Flutter application:

$ flutter run

Next Steps#

Once installed, you're ready to start using Realtime Database in your Flutter Project.

Additional documentation will be available once the Realtime Database plugin update lands as part of the FlutterFire roadmap.