Skip to content

Latest commit

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

crossfire

Cross-platform APIs for Firebase.

Supported APIs

  • Firebase Auth (currently only with custom tokens)
  • Firestore (collections and documents)
  • Cloud Storage

Usage

Build your API using a crossfireFirebase object:

import'package:crossfire/crossfire.dart';
classMyFancyApp {
finalFirebase _firebase; MyFancyApp(this._firebase);
}

and build some API methods:

import'package:crossfire/crossfire.dart';
classMyFancyApp {
finalFirebase _firebase; MyFancyApp(this._firebase);
FuturesaveData() async {
var docRef =await _firebase.getDocument("path/to/doc");
docRef.setData({"hello":"firebase"});
}
}

Then inject the Firebase implementation based on the platform:

import'package:crossfire/crossfire.dart';
import'package:crossfire_web/crossfire_web.dart';
FirebaseConfiguration configuration;
FuturesetupMyApp() async {
var firebase =newFirebaseWeb();
await firebase.init(configuration);
var app =newMyFancyApp();
}
import'package:crossfire/crossfire.dart';
import'package:crossfire_web/crossfire_flutter.dart';
FirebaseConfiguration configuration;
FuturesetupMyApp() async {
var firebase =newFirebaseFlutter();
await firebase.init(configuration);
var app =newMyFancyApp();
}

note: a FirebaseConfiguration usually looks something like this:

FirebaseConfiguration configuration;
voidsetupConfig() {
configuration =newFirebaseConfiguration(
apiKey:"<API_KEY>",
databaseUrl:"https://mydb.firebaseio.com",
storageBucket:"myapp.appspot.com",
projectId:"myproject",
iosGoogleAppId:"1:111111111111:ios:22222222222222222",
androidGoogleAppId:"1:111111111111:android:22222222222222222",
);
}

About

No description, website, or topics provided.

Resources

Stars

40 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages