Skip to content

Repository files navigation

ChatApp — Flutter

A cross-platform chat application built with Flutter and Firebase, designed with an offline-first data layer.

Overview

ChatApp is a mobile messaging app demonstrating a realistic architecture: Firebase authentication, a cloud message store (Firestore), and a local SQLite cache that keeps the UI usable when the device is offline and syncs once connectivity returns.

Key features

  • Authentication — Google Sign-In and phone/SMS code login via Firebase Auth, with a reactive AuthGate that switches between login and home based on auth state.
  • Messaging — chat screen backed by Cloud Firestore (network source) and sqflite (local cache).
  • Offline-first sync — a SyncService coordinates the local SQLite database and Firestore; a NetworkService (connectivity_plus) exposes a connectivity stream.
  • Cross-platform — Android, iOS, web, desktop targets scaffolded by Flutter.

Architecture

lib/
├── main.dart                       # App bootstrap, Firebase init, AuthGate
├── screens/
│   ├── loginScreen.dart            # Google / phone login
│   ├── sms_code_screen.dart        # Phone OTP code entry
│   ├── homeScreen.dart             # Conversations list
│   └── chatScreen.dart             # Chat view
└── datas/
    ├── message_model.dart          # Message model
    ├── local_database_service.dart # SQLite (sqflite) persistence
    ├── network_service.dart        # Firestore + connectivity stream
    └── sync_service.dart           # Local ↔ cloud sync logic

Tech stack

  • Flutter / Dart
  • Firebase: Firebase Auth, Cloud Firestore, Firebase Core
  • Google Sign-In
  • sqflite (SQLite), path_provider, path
  • connectivity_plus for network monitoring

Getting started

  1. Create a Firebase project and enable Authentication (Google + Phone) and Cloud Firestore.
  2. Add the platform config files (google-services.json for Android, GoogleService-Info.plist for iOS) to the app.
  3. Run the app:
flutter pub get
flutter run

Testing

flutter test

Notes

  • Requires a configured Firebase project — the app is not functional without its own Firebase backend credentials.
  • The sync layer targets a simple 1:1 chat model; group-chat and rich media are natural next steps.

License

MIT

About

Cross-platform chat app in Flutter with Firebase Auth, local persistence and offline-first sync.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages