Skip to content

apptreesoftware/crossfire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

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 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",
  );
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages