Version: 1.0
Author: Irfan Tariq
The Daud Chat App is a mobile chat application built using Flutter and Firebase. It allows users to send and receive messages in real-time. Firebase services such as Authentication, Firestore for storing messages, and Firebase Cloud Messaging (FCM) for push notifications are used to power this app.
Go to Firebase Console and create a new project. Then, follow these steps:
Download the google-services.json file from Firebase Console and place it in the android/app directory.
flutter pub get flutter run The folder structure of the project is organized as follows:
/lib /screens chat_screen.dart login_screen.dart signup_screen.dart /services auth_service.dart chat_service.dart /models user_model.dart message_model.dart main.dart The app uses Firebase services for authentication and real-time messaging. Make sure to configure the Firebase project by adding the google-services.json file and initializing Firebase in your main.dart file.
void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp(DaudChatApp()); } User authentication is implemented using Firebase Authentication. Users can sign up and log in using their email and password.
final FirebaseAuth _auth = FirebaseAuth.instance; Future<User?> signInWithEmail(String email, String password) async { try { UserCredential result = await _auth.signInWithEmailAndPassword(email: email, password: password); return result.user; } catch (e) { print(e.toString()); return null; } } The app uses Firebase Firestore for storing and retrieving chat messages in real time.
final FirebaseFirestore _firestore = FirebaseFirestore.instance; Stream<QuerySnapshot> getMessages() { return _firestore.collection('chats').orderBy('timestamp').snapshots(); } Firebase Cloud Messaging (FCM) is used to send push notifications to users when they receive new messages.
To enable FCM, follow the instructions in the Firebase Cloud Messaging Guide.
The Daud Chat App provides a basic template for building a real-time chat application using Flutter and Firebase. Further enhancements can be made by adding more features such as group chats, media sharing, and advanced user settings.
0 average based on 0 ratings.
| Last Update | 2024-07-16 |
| Created | 2024-03-06 |
| Sales | 0 |
| Discussion | Comments |
| Software Version | Flutter 3.x |
| Files Included | Dart |
| Video Preview Resolution |