A cross-platform chat application built with Flutter and Firebase, designed with an offline-first data layer.
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.
- Authentication — Google Sign-In and phone/SMS code login via Firebase Auth, with a reactive
AuthGatethat 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
SyncServicecoordinates the local SQLite database and Firestore; aNetworkService(connectivity_plus) exposes a connectivity stream. - Cross-platform — Android, iOS, web, desktop targets scaffolded by Flutter.
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
- Flutter / Dart
- Firebase: Firebase Auth, Cloud Firestore, Firebase Core
- Google Sign-In
- sqflite (SQLite), path_provider, path
- connectivity_plus for network monitoring
- Create a Firebase project and enable Authentication (Google + Phone) and Cloud Firestore.
- Add the platform config files (
google-services.jsonfor Android,GoogleService-Info.plistfor iOS) to the app. - Run the app:
flutter pub get
flutter runflutter test- 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.
MIT