Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Firebase dart common interface and implementation for Browser, VM, node, and flutter

firebase.dart

Firebase dart common interface and implementation for Browser, VM, node, and flutter

Firebase Initialization

Usage in browser

import 'package:tekartik_firebase_browser/firebase_browser.dart';

void main() {
  var firebase = firebaseNode;
  // ...
}

Usage on node

import 'package:tekartik_firebase_node/firebase_node.dart';

void main() {
  var firebase = firebaseNode;
  // ...
}

Usage on flutter

dependencies:
  tekartik_firebase_flutter:
    git:
      url: git://github.com/tekartik/firebase.dart
      path: firebase_flutter
      ref: dart2
    version: '>=0.3.9'
import 'package:tekartik_firebase_flutter/firebase_flutter.dart';

void main() {
  var firebase = firebaseFlutter;
  // ...
}

Usage on sembast (io simulation)

import 'package:tekartik_firebase_sembast/firebase_sembast_io.dart';

void main() {
  var firebase = firebaseSembastIo;
  // ...
}

App initialization

var options =  new AppOptions(
    apiKey: "your_api_key",
    authDomain: "xxxx",
    databaseURL: "xxxx",
    projectId: "xxxx",
    storageBucket: "xxxx",
    messagingSenderId: "xxxx"); 
var app =  firebase.initializeApp(options);
  // ...
}

Firestore access

var firestore = app.firestore();
// read a document
var data = (await firestore.doc('collections/document').get()).data;
// ...

Storage access

Experimental, not fully implemented yet

var storage = app.storage();
// ...

Download Firebase dart common interface and implementation for Browser, VM, node, and flutter Source code on GitHub

https://github.com/tekartik/firebase.dart

Exit mobile version