flutter-chat-pro.mp4.mp4

GitHub - fireship-io/firechat-flutter: Firebase chat app made with Flutter

Flutter makes it possible to build high-performance cross-platform apps with sound type safety thanks to the Dart programming language. It provides excellent support for Firebase with official plugins maintained by Google.

In the following lesson, we will build a basic chat app with Flutter and Firebase. It allows a user to sign in with Google and then access a group chat room. The user can read a realtime feed of recent chat messages via Firestore and post new messages into the chat. The goal is to demonstrate essential patterns when working connecting Firebase users to their data in a Flutter app.

Setup


Create a Flutter App

Create an app with the Flutter CLI.

Install Firebase

Follow the official Firebase setup instructions. This tutorial targets Android as the primary platform.

Make sure to enable Google Authentication on the Firebase console and follow the instructions to obtain an SHA1 key.

Add the following packages as dependencies:

pubspec.yaml

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.3
  firebase_core: 1.6.0
  firebase_auth: 3.1.1
  google_sign_in: 5.1.0
  cloud_firestore: 2.5.3

Data Model

Firestore consists of a single collection chats where each document contains the following data: