/firebase3-dart

Dart wrapper library for the new Firebase.

Primary LanguageDartMIT LicenseMIT

Dart wrapper library for the new Firebase

This is an unofficial Dart wrapper library for the new Firebase.

You can find more information on how to use Firebase on Getting started page.

Don't forget to setup correct rules for your realtime database and/or storage in Firebase console. Auth has to be also set in the Firebase console if you want to use it.

Usage

Installation

Install the library from the pub or Github.

Include Firebase source

You must include the original Firebase JavaScript source into your .html file to be able to use the library.

<script src="https://www.gstatic.com/firebasejs/3.2.1/firebase.js"></script>

Use it

import 'package:firebase3/firebase.dart' as firebase;
import 'package:firebase3/database.dart';

void main() {
  firebase.initializeApp(
    apiKey: "YourApiKey",
    authDomain: "YourAuthDomain",
    databaseURL: "YourDatabaseUrl",
    storageBucket: "YourStorageBucket");
    
  Database database = firebase.database();
  DatabaseReference ref = database.ref("messages");  

  ref.onValue.listen((e) {
    DataSnapshot datasnapshot = e.snapshot;
    //Do something with datasnapshot
  });
  
  ...
}

Examples

You can find more examples on realtime database, auth and storage in the example folder.

Bugs

This is the first version of the library, the bugs may appear. If you find a bug, please create an issue.