Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Latest commit 5858e54 May 8, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
crossfire 2.1.0 Mar 12, 2019
crossfire_flutter
crossfire_web
.gitignore
README.md add supported APIs Jul 12, 2018

README.md

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 crossfire Firebase object:

import 'package:crossfire/crossfire.dart';

class MyFancyApp {
  final Firebase _firebase;  
  MyFancyApp(this._firebase);
}

and build some API methods:

import 'package:crossfire/crossfire.dart';

class MyFancyApp {
  final Firebase _firebase;  
  MyFancyApp(this._firebase);
  
  Future saveData() 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;

Future setupMyApp() async {
  var firebase = new FirebaseWeb();
  await firebase.init(configuration);
  var app = new MyFancyApp();
}
import 'package:crossfire/crossfire.dart';
import 'package:crossfire_web/crossfire_flutter.dart';
FirebaseConfiguration configuration;

Future setupMyApp() async {
  var firebase = new FirebaseFlutter();
  await firebase.init(configuration);
  var app = new MyFancyApp();
}

note: a FirebaseConfiguration usually looks something like this:

FirebaseConfiguration configuration;
void setupConfig() {
  configuration = new FirebaseConfiguration(
    apiKey: "<API_KEY>",
    databaseUrl: "https://mydb.firebaseio.com",
    storageBucket: "myapp.appspot.com",
    projectId: "myproject",
    iosGoogleAppId: "1:111111111111:ios:22222222222222222",
    androidGoogleAppId: "1:111111111111:android:22222222222222222",
  );
}
You can’t perform that action at this time.