5 Best Flutter Packages to Work with Firebase

Firebase is Google’s backend as a service for mobile application development. It provides developers with a variety of tools and services to help them develop quality apps, and grow their user base. Firebase is the go to solution of many developers when it comes to BaaS for mobile app.

Following the the best Flutter libraries to help work with Firebase easier:

firebase

This is a Dart package, maintained by Googlers, which allows developers to connect with Firebase services. It works for both mobile and web platforms.

//read database
Database db = database();
DatabaseReference ref = db.ref('messages');

ref.onValue.listen((e) {
  DataSnapshot datasnapshot = e.snapshot;
  // Do something with datasnapshot
});

firebase_core

This is a Flutter plugin to use the Firebase Core API, which enables connecting to multiple Firebase apps.

//querying database with FutureBuilder
@override
Widget build(BuildContext context) {
  return FutureBuilder(
    // Initialize FlutterFire:
    future: _initialization,
    builder: (context, snapshot) {
      // Check for errors
      if (snapshot.hasError) {
        print('Error');
      }

      // Once complete, show your application
      if (snapshot.connectionState == ConnectionState.done) {
        return Container();
      }

      // Otherwise, show something whilst waiting for initialization to complete
      return Text('Loading');
    },
  );
}

If you want to use certain tools of Firebase, pick one of the following instead of the firebase_core package.

  • firebase_auth – This plugin is for Firebase Auth, enabling Android and iOS authentication using passwords, phone numbers and identity providers like Google, Facebook and Twitter.
FirebaseAuth.instance
  .authStateChanges()
  .listen((User user) {
    if (user == null) {
      print('User is currently signed out!');
    } else {
      print('User is signed in!');
    }
  });
  • firebase_admob – Flutter plugin for Firebase AdMob, supporting banner, interstitial (full-screen), and rewarded video ads.
  • firebase_dynamic_links – Flutter plugin for Google Dynamic Links for Firebase, an app solution for creating and handling links across multiple platforms.
  • firebase_ml_vision – Flutter plugin for Firebase machine learning vision services.
  • firebase_analytics – Flutter plugin for Google Analytics for Firebase, an app measurement solution that provides insight on app usage and user engagement on Android and iOS.
  • cloud_functions – allows you to use Firebase Cloud Functions.
  • firebase_crashlytics – Flutter plugin for Firebase Crashlytics. It reports uncaught errors to the Firebase console.
  • firebase_storage – Flutter plugin for Firebase Cloud Storage, a powerful, simple, and cost-effective object storage service for Android and iOS.
  • firebase_messaging – Flutter plugin for Firebase Cloud Messaging, a cross-platform messaging solution that lets you reliably deliver messages on Android and iOS.
  • firebase_database – Flutter plugin for Firebase Database, a cloud-hosted NoSQL database with realtime data syncing across Android and iOS clients, and offline access.

firedart

This is a dart-native implementation of the Firebase Auth and Firestore SDKs, which attempts to minimize dependencies with the intention of making it able to run in any environment capable of executing dart code.

FirebaseAuth.initialize(apiKey, await HiveStore.create());
await FirebaseAuth.instance.signIn(email, password);
var user = await FirebaseAuth.instance.getUser();

firebase_image

This package provides cached Flutter ImageProvider for Firebase Cloud Storage image objects.

Image(
  image: FirebaseImage('gs://appname/myImage.jpg'),  
  fit: BoxFit.fitWidth,
  width: 300,  
)

lit_firebase_auth

Pre-lit Firebase Authentication library provides a set of convenient utilities and widgets to easily add Firebase authentication to a Flutter app.

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // Needs to be above [MaterialApp]/[CupertinoApp]
    return LitAuthInit(
      // specify which auth providers to enable
      authProviders: AuthProviders(
        emailAndPassword: true, // enabled by default
        google: true,
        apple: true,
        twitter: true,
        github: true,
        anonymous: true,
      ),
      child: MaterialApp(
        title: 'Material App',
        home: Home(),
      ),
    );
  }
}

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close