Get X Firebase

pub package likes building Telegram

A Flutter Package that implemented firebase services with getx package.

It's free, open source, complete, rapid development package for creating Social apps, Chat apps, Community(Forum) apps, Shopping mall apps, and much more based on Firebase.

  • Complete features.
    This package has complete features (see Features below) that most of apps require.
  • Simple, easy and the right way.
    We want it to be deadly simple yet, right way for ourselves and for the developers in the world. We know when it gets complicated, our lives would get even more complicated.
  • Real time.
    We design it to be real time when it is applied to your app. All the events like post and comment creation, voting(like, dislike), deletion would appears on all the user's phone immediately after the event.

Help Maintenance

I've been maintaining quite many repos these days and burning out slowly. If you could help me cheer up, buying me a cup of coffee will make my life really happy and get much energy out of it.



Contact Me & Social Media

Features

  • User

    • User registration and login with email/password
    • User profile update
    • User profile photo update
    • Social logins
      • Google
      • Apple (Coming Soon)
      • Facebook (Coming Soon)
    • Phone number authentication (Coming Soon)
  • Push notifications (Coming Soon)

    • Admin can send push notifications to all users.
    • Admin can send push notifications to users of a forum.
    • User can enable/disable to get notification when other users creates comments under his posts/comments.
    • User can subscribe/unsubscribe for new posts or comments under a forum.
  • Location (Coming Soon)

    • App can update login user's GEO location. There are many possiblities by saving GEO location.
    • App can search other users(by distance, gender) near the login user GEO point.
  • Security

    • Tight Firestore security rules are applied.
  • Fully Customizable
    • GetxFire package does not involve in any of part application's login or UI. It is completely separated from the app. Thus, it's highly customizable.

Getting Started

Installation

Install the library from pub:

dependencies:
  getxfire: <latest-version>

Import the library

import 'package:getxfire/getxfire.dart';

Init GetxFire

Add this inside main() function at main.dart file:

WidgetsFlutterBinding.ensureInitialized();
await GetxFire.init();

Usage

Open Dialog

Will popup success message :

GetxFire.openDialog.messageSuccess("Create User successfully!");

Will popup error message :

GetxFire.openDialog.messageError("Failed to Create User!");

Will popup info message :

GetxFire.openDialog.info(
  lottiePath: GetxFire.lottiePath.COMING_SOON,
  lottiePadding: EdgeInsets.only(top: 50),
);

Will popup message with yes and no confirm button :

GetxFire.openDialog.confirm(
  content: "Are you sure to sign out?",
  lottiePath: GetxFire.lottiePath.THINKING, // lottiePath: "assets/lottie/coffee-favorite.json",
  onYesClicked: () async {
    final User user = GetxFire.currentUser;
    if (user == null) {
      ScaffoldMessenger.of(context)
          .showSnackBar(const SnackBar(
        content: Text('No one has signed in.'),
      ));
      return;
    }
    await GetxFire.signOut();

    final String uid = user.uid;
    ScaffoldMessenger.of(context).showSnackBar(SnackBar(
      content: Text('$uid has successfully signed out.'),
    ));
  },
);

Get Lottie Assets Available

GetxFire.lottiePath.<functions>

We can get default lottie animation assets, such as : THINKING, COMING_SOON, SEARCH_FILES, SAD_HEART, NO_ACTIVITY, MULTI_TASKING, IMAGE_ICON, EMPTY_BOX, and COFFEE_FAVORITE

class LottiePath {
  final THINKING = "assets/lottie/thinking.json";
  final COMING_SOON = "assets/lottie/coming-soon.json";
  final SEARCH_FILES = "assets/lottie/search-files.json";
  final SAD_HEART = "assets/lottie/sad-heart.json";
  final NO_ACTIVITY = "assets/lottie/no-activity.json";
  final MULTI_TASKING = "assets/lottie/multi-tasking.json";
  final IMAGE_ICON = "assets/lottie/image-icon.json";
  final EMPTY_BOX = "assets/lottie/empty-box.json";
  final COFFEE_FAVORITE = "assets/lottie/coffee-favorite.json";
}

Example :

GetxFire.lottiePath.THINKING

Show and Hide Progress Bar

Example :

// This for show loading progress bar
GetxFire.showProgressHud();

// This for hide loading progress bar
GetxFire.hideProgressHud();

Converter Date, etc.

GetxFire.converter.<functions>

Helper Scripts

GetxFire.helper.<functions>

For Use FirebaseAuth.instance Services

GetxFire.auth.<functions>

For Use Firestore Services

GetxFire.firestore.<functions>

For Use Storage Services

GetxFire.storage.<functions>

Login Anonymously

await GetxFire.signInAnonymously(
  onSuccess: (userCredential) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text(
            'Signed in Anonymously as user ${userCredential.user.uid}'),
      ),
    );
  },
  onError: (code, message) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text('Failed to sign in Anonymously\n$message'),
      ),
    );
  },
);

Login Email & Password

await GetxFire.signInWithEmailAndPassword(
  email: _emailController.text,
  password: _passwordController.text,
  onSuccess: (userCredential) {
    ScaffoldMessenger.of(context).showSnackBar(
      SnackBar(
        content: Text('${userCredential.user.email} signed in'),
      ),
    );
  },
  onError: (code, message) {},
);

Login With Google (Google Sign-in)

await GetxFire.signInWithGoogle(
  onSuccess: (userCredential) {
    final user = userCredential.user;
    ScaffoldMessenger.of(context).showSnackBar(SnackBar(
      content: Text('Sign In ${user.uid} with Google'),
    ));
  },
  onError: (code, message) {
    // ScaffoldMessenger.of(context).showSnackBar(
    //   SnackBar(
    //     content: Text('Failed to sign in with Google: $message'),
    //   ),
    // );
  },
);

For Get Current User

GetxFire.currentUser

example :

User user = GetxFire.currentUser;

For Get Current User Changes

Add this inside void initState() function at statfullwidget :

GetxFire.userChanges().listen((event) => setState(() {}));

For Get Current User State Changes

Add this inside void initState() function at statfullwidget :

GetxFire.userStateChanges(setState);

References

Packages Dependencies

These are the available Packages Dependencies in this repository.

Plugin Pub Points Popularity Likes
firebase_core pub package pub points popularity likes
firebase_auth pub package pub points popularity likes
cloud_firestore pub package pub points popularity likes
firebase_storage pub package pub points popularity likes
firebase_dynamic_links pub package pub points popularity likes
firebase_analytics pub package pub points popularity likes
google_sign_in pub package pub points popularity likes
intl pub package pub points popularity likes
get pub package pub points popularity likes
lottie pub package pub points popularity likes
font_awesome_flutter pub package pub points popularity likes
image_picker pub package pub points popularity likes
image_cropper pub package pub points popularity likes
flutter_animated_dialog pub package pub points popularity likes
flutter_spinkit pub package pub points popularity likes
flutter_web_browser pub package pub points popularity likes

Components

  • Firebase
    Firebase is a leading cloud system powered by Google. It has lots of goods to build web and app.

    • We first built it with Firebase and LEMP(Linux + Nginx + MariaDB + PHP). It was fine but was a pressure to maintain two different systems. So, We decided to remove LEMP and built it again with Firebase only.

    • You may use Firebase as free plan for a test.

  • Flutter
    Flutter as its app development toolkit.

  • And other open source Flutter & Dart packages.

Requirements

  • Basic understanding of Flutter and Dart.
  • Basic understanding of Firebase.
  • Editor: VSCode, Xcode(for Mac OS).
    Our primary editor is VSCode and we use Xcode for Flutter settings. We found it more easy to do the settings with Xcode for iOS development.

Installation & Usage

  • To use this plugin, please visit the GetxFire Wiki Documentation

  • If you are not familiar with Firebase and Flutter, you may have difficulties to install it.

    • GetxFire is not a smple package that you just add it into pubspec.yaml and ready to go.
    • Many of the settings are coming from the packages that getxfire is using. And for release, it may need extra settgins.
    • Most of developers are having troubles with settings. You are not the only one. Ask us on Git issues.
  • We will cover all the settings and try to put it as demonstrative as it can be.

    • We will begin with Firebase settings and contiue gradual settings with Flutter.
  • And please let us know if there is any mistake on the documentation.

State Management

GetX : https://pub.dev/packages/get

GetX is an extra-light and powerful solution for Flutter. It combines high-performance state management, intelligent dependency injection, and route management quickly and practically.

GetX has 3 basic principles. This means that these are the priority for all resources in the library: PRODUCTIVITY, PERFORMANCE AND ORGANIZATION.

GetX is not bloated. It has a multitude of features that allow you to start programming without worrying about anything, but each of these features are in separate containers and are only started after use. If you only use State Management, only State Management will be compiled. If you only use routes, nothing from the state management will be compiled.

GetX has a huge ecosystem, a large community, a large number of collaborators, and will be maintained as long as the Flutter exists. GetX too is capable of running with the same code on Android, iOS, Web, Mac, Linux, Windows, and on your server.