<<<<<<< HEAD A Flutter-based chat application with AI integration.
======= A feature-rich Flutter-based chat application with AI integration, user-to-user messaging, and Firebase backend support. This app demonstrates modern Flutter development practices including Riverpod state management, clean architecture, and Firebase integration.
- π€ AI Chat - Chat with AI powered by OpenRouter LLM
- π₯ User-to-User Chat - Real-time messaging between users
- π Authentication - Google Sign-In and OTP-based authentication with Firebase
- π Push Notifications - Real-time notifications via Firebase Cloud Messaging
- π Multi-Language Support - English, Khmer, Japanese, and Spanish
- π¨ Theme Support - Light and dark theme modes
- π± Responsive Design - Works seamlessly on Android and iOS
- πΎ Local Storage - Task management with local persistence using Hive
- Framework: Flutter 3.x
- State Management: Riverpod
- Backend: Firebase (Authentication, Firestore, Cloud Messaging)
- API Client: Dio
- Local Database: Hive
- LLM Integration: OpenRouter API
- Code Generation: Freezed, JsonSerializable
Before you begin, ensure you have:
- Flutter SDK (3.0+) - Install Flutter
- Dart SDK (included with Flutter)
- Android Studio or Xcode (for emulator/device)
- Firebase Account - Create at Firebase Console
- Git - For cloning the repository
flutter --version
dart --version7d9fef6f29f2a57f4f5db38905d5c8924ec4ab30
This guide will walk you through setting up and running the project. Follow these steps carefully, and you'll have the app running in no time!
First, get the project files onto your computer.
git clone <repository-url>
cd <repository-directory>It's always a good idea to start with a clean slate and fetch all necessary packages.
flutter clean
flutter pub getThis project uses Firebase for authentication, database, and other services. You'll need to connect your app to your own Firebase project.
- Go to the Firebase console.
- Click "Add project" and follow the on-screen instructions to create a new project.
This is crucial for features like Google Sign-In and push notifications.
-
Add an Android App: In your Firebase project, click the Android icon to add a new Android app.
- Package Name: Enter your app's package name. You can find this in
android/app/build.gradle.kts(look forapplicationId).
- Package Name: Enter your app's package name. You can find this in
-
Get Your SHA-1 and SHA-256 Keys: These keys are essential for Google Sign-In and other Firebase services to verify your app's authenticity.
-
For Windows: Open your terminal and run this command:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android -
For macOS and Linux: Open your terminal and run this command:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -
After running the command, copy both the
SHA1andSHA256fingerprints from the output.
-
-
Add SHA Keys to Firebase: In your Firebase project settings, select your Android app, then click "Add fingerprint" and paste your copied SHA-1 and SHA256 keys.
-
Download
google-services.json: Download thegoogle-services.jsonfile from the Firebase console. -
Place
google-services.json: Move this downloaded file into theandroid/appdirectory of your Flutter project.
- Add an iOS App: In your Firebase project, click the iOS icon to add a new iOS app.
- Download
GoogleService-Info.plist: Download theGoogleService-Info.plistfile from the Firebase console. - Place
GoogleService-Info.plist: Move this file into theios/Runnerdirectory of your Flutter project.
If you make changes to your Firestore security rules (firestore.rules), you'll need to deploy them.
firebase deploy --only firestore:rules --project <your-firebase-project-id>Replace <your-firebase-project-id> with your actual Firebase project ID.
<<<<<<< HEAD
The application uses Custom LLM via OpenRouter for its AI chat features. For detailed steps on how to obtain your API key, refer to How to Get Your OpenRouter AI API Key.
-
Create a file named
.envin the root of the project. -
Add your OpenRouter API key to the
.envfile as follows:AI_API_KEY='your_api_key_here'
=======
This project requires several API keys and configuration values. These are stored in a .env file which is not included in the repository for security reasons.
-
Copy the example file to create your own:
cp .env.example .env
-
Edit the
.envfile and replace all placeholder values with your actual credentials:# LLM Configuration (Required for AI features) AI_API_KEY=your_actual_api_key_here CUSTOM_LLM_ENDPOINT=https://your-custom-llm-endpoint.com/api/v1/chat/completions CUSTOM_LLM_model=your_model_name BASE_API_URL=https://your-backend-api-url.com # Firebase Configuration (Required) FIREBASE_PROJECT_ID=your_firebase_project_id FIREBASE_API_KEY=your_firebase_api_key FIREBASE_APP_ID=your_firebase_app_id FIREBASE_MESSAGING_SENDER_ID=your_firebase_sender_id FIREBASE_STORAGE_BUCKET=your_firebase_storage_bucket FIREBASE_ANDROID_CLIENT_ID=your_android_client_id FIREBASE_IOS_CLIENT_ID=your_ios_client_id FIREBASE_IOS_BUNDLE_ID=your_ios_bundle_id
- AI_API_KEY & CUSTOM_LLM Settings: For OpenRouter LLM integration, see How to Get Your OpenRouter AI API Key
- Firebase Configuration: Get these from your Firebase project settings
- Backend API URL: Use your own backend API endpoint (or a development server URL)
7d9fef6f29f2a57f4f5db38905d5c8924ec4ab30
This project uses code generation. You need to run the build runner to generate necessary files.
flutter run build_runnerFinally, launch the application!
flutter runlib/
βββ app.dart # Main app configuration
βββ main.dart # Entry point
βββ firebase_options.dart # Firebase configuration
βββ core/
β βββ api/ # API client setup (Dio)
β βββ config/ # Environment configuration
β βββ services/ # Services (Firebase, Sound, etc.)
β βββ utils/ # Utility functions
β βββ widgets/ # Reusable widgets
β βββ errors/ # Error handling
βββ features/
β βββ ai_chat/ # AI Chat feature
β βββ utou_chat/ # User-to-User Chat feature
β βββ auth/ # Authentication feature
β βββ home/ # Home/Dashboard feature
β βββ tasks/ # Task management feature
β βββ app_settings/ # App settings & preferences
β βββ user/ # User profile feature
βββ l10n/ # Localization files
βββ app/
βββ router.dart # Route configuration
βββ theme/ # Theme configuration
Problem: Plugin not initialized
Solution: Run flutter clean and flutter pub get
Problem: google-services.json not found
Solution: Ensure google-services.json is placed in android/app/ directory
Problem: Strange compilation errors
Solution: Clean everything:
flutter clean
rm -rf pubspec.lock
flutter pub getProblem: BaseUrl must be a valid URL
Solution: Check .env file has a valid BASE_API_URL value
Problem: FocusScopeNode already disposed
Solution: Update to the latest version of the app (we've fixed this)
- No notifications? Ensure Firebase Cloud Messaging is enabled in your Firebase Console
- Auth not working? Check SHA-1 and SHA-256 keys are correctly added to Firebase
- Firestore errors? Verify firestore rules are deployed:
firebase deploy --only firestore:rules
For more detailed information, check out our documentation:
- Getting Started Guide
- Firebase Setup Guide
- Localization Setup
- Notification Integration
- OpenRouter API Key Setup
- Best Practices
- Project Structure Details
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code follows the Best Practices guide.
This project is licensed under the MIT License - see the LICENSE file for details.
For issues, feature requests, or questions:
- Open an GitHub Issue
- Check existing documentation
- Flutter team for the amazing framework
- Firebase for backend services
- OpenRouter for LLM integration
- All our contributors and supporters
7d9fef6f29f2a57f4f5db38905d5c8924ec4ab30