Skip to content

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

License

Notifications You must be signed in to change notification settings

tekartik/firebase_firestore.dart

Repository files navigation

firebase_firestore.dart

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

Firebase Initialization

Usage in browser

import 'firestore_browser';

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

Usage on node

import 'firestore_node';

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

Usage on flutter

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();
// ...

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published