Daud chat App with Flutter & Firebase icon

Daud chat App with Flutter & Firebase

Hot or Not
Daud chat App with Flutter & Firebase

Description

Daud Chat App Documentation

Version: 1.0

Author: Irfan Tariq

Introduction

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.

Features

  • User authentication using Firebase Authentication (Email & Password).
  • Real-time messaging using Firebase Firestore.
  • Push notifications using Firebase Cloud Messaging (FCM).
  • User profiles with display names and profile pictures.
  • Responsive and interactive UI.

Technologies Used

  • Flutter – for building the mobile UI.
  • Firebase Authentication – for managing user login/signup.
  • Firebase Firestore – for storing chat messages and user data.
  • Firebase Cloud Messaging (FCM) – for sending push notifications.

Setup Instructions

Prerequisites

  • Flutter SDK installed
  • Firebase account
  • Basic knowledge of Flutter and Firebase

2. Set Up Firebase

Go to Firebase Console and create a new project. Then, follow these steps:

  • Enable Firebase Authentication (Email/Password).
  • Create Firestore Database.
  • Configure Firebase Cloud Messaging (FCM) for notifications.

3. Configure Firebase in Flutter

Download the google-services.json file from Firebase Console and place it in the android/app directory.

4. Install Dependencies

flutter pub get

5. Run the App

flutter run

Folder Structure

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
        

Firebase Configuration

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.

Example of Firebase Initialization

 
void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    await Firebase.initializeApp();
    runApp(DaudChatApp());
}
        

Authentication

User authentication is implemented using Firebase Authentication. Users can sign up and log in using their email and password.

Example of Authentication Code

 
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;
    }
}
        

Real-Time Messaging

The app uses Firebase Firestore for storing and retrieving chat messages in real time.

Example of Firestore Integration

 
final FirebaseFirestore _firestore = FirebaseFirestore.instance;

Stream<QuerySnapshot> getMessages() {
    return _firestore.collection('chats').orderBy('timestamp').snapshots();
}
        

Push Notifications

Firebase Cloud Messaging (FCM) is used to send push notifications to users when they receive new messages.

FCM Setup

To enable FCM, follow the instructions in the Firebase Cloud Messaging Guide.

Conclusion

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.

TypeFlutter App
Authoryokit1
Price$24
Sales0
Rating0 (0)
PublishedMar 5, 2024
Last UpdateJul 15, 2024
Compatible SoftwareFlutter 3.x
Mobile Files IncludedDart

Categories

Tags

androidchat appfirebaseflutteriosmobile app developmentweb platforms

External listing. code.market does not sell this product and does not process payment for it. Pricing, payment, delivery, licensing, refunds, and support are handled by the third-party merchant on its own website. We may earn an affiliate commission from a referral. Details.