Firebase Realtime Database for Flutter

pub package

A Flutter plugin to use the Firebase Realtime Database API.

For Flutter plugins for other Firebase products, see README.md.

Usage

To use this plugin, add firebase_database as a dependency in your pubspec.yaml file. You will also need the firebase_core dependency if you do not have it already.

Example connecting to the default database:

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';

final FirebaseApp app = FirebaseApp(name: '[DEFAULT]');
final DatabaseReference db = FirebaseDatabase(app: firebaseApp).reference();
db.child('your_db_child').once().then((result) => print('result = $result'));

Getting Started

See the example directory for a complete sample app using Firebase Realtime Database.

You might also consider watching this getting started video.

The Firebase Realtime Database and Flutter - Firecasts

Issues and feedback

Please file FlutterFire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide and open a pull request.

Testing

The unit test is in test directory which you can run using flutter test. The integration test is in example/test_driver/firebase_database_e2e.dart which you can run on an emulator:

cd example
flutter drive --target=./test_driver/firebase_database_e2e.dart

To test the web implementation, download and run ChromeDriver, and then run flutter_drive:

flutter drive --target=./test_driver/firebase_database_e2e.dart  -d web-server --release --browser-name=chrome --web-port=8080