A modern, real-time chat application built with Flutter, featuring customer and vendor login functionality, real-time messaging, and offline support.
- Dual User Types: Support for both Customer and Vendor login
- Secure Login: Email and password authentication with role-based access
- Session Management: Persistent login sessions with automatic token refresh
- Instant Messaging: Real-time message delivery using Socket.IO
- Chat History: Persistent chat history with offline support
- Message Types: Support for text, image, and file messages
- Delivery Status: Message delivery and read receipts
- Typing Indicators: Real-time typing status updates
- Chat List: Overview of all conversations
- Unread Counts: Track unread messages per chat
- Last Message Preview: Quick preview of recent conversations
- Search Functionality: Find specific chats and messages
- MVVM Pattern: Clean separation of concerns
- BLoC State Management: Reactive state management with Flutter BLoC
- Repository Pattern: Clean data access layer
- Offline First: Local storage with API synchronization
- Flutter: Cross-platform mobile development framework
- Dart: Programming language
- Material Design 3: Modern UI components
- flutter_bloc: BLoC pattern implementation
- equatable: Value equality for immutable objects
- HTTP/Dio: REST API communication
- Socket.IO: Real-time bidirectional communication
- WebSocket: Fallback transport for Socket.IO
- SharedPreferences: User preferences and settings
- Local Database: Offline message and chat storage
- flutter_test: Unit and widget testing
- mockito: Mocking for testing
lib/
├── blocs/ # Business Logic Components
│ ├── auth_bloc.dart
│ └── chat_bloc.dart
├── constants/ # App constants and configurations
│ └── api_constants.dart
├── models/ # Data models
│ ├── chat_model.dart
│ └── user_model.dart
├── services/ # Business logic services
│ ├── api_service.dart
│ └── socket_service.dart
├── utils/ # Utility functions and helpers
│ └── helpers.dart
├── views/ # UI screens and widgets
│ ├── chat_list_screen.dart
│ ├── chat_screen.dart
│ ├── login_screen.dart
│ └── splash_screen.dart
└── main.dart # App entry point
http://45.129.87.38:6065/
- POST
/user/login- User login with email, password, and role
- GET
/chats/user-chats/:userId- Get user's chat list - GET
/messages/get-messagesformobile/:chatId- Get chat messages - POST
/messages/sendMessage- Send a new message
- Connection: Automatic reconnection with exponential backoff
- Join/Leave Rooms: Real-time chat room management
- Message Events: New message, delivery, and read receipts
- Typing Indicators: Real-time typing status
- Flutter SDK (3.0.0 or higher)
- Dart SDK (3.0.0 or higher)
- Android Studio / VS Code
- Android SDK / Xcode (for mobile development)
-
Clone the repository
git clone https://github.com/yourusername/flutter_chat_app.git cd flutter_chat_app -
Install dependencies
flutter pub get
-
Run the application
flutter run
- API Configuration: Update API endpoints in
lib/constants/api_constants.dart - Socket Configuration: Configure Socket.IO server URL in the same file
- Build Configuration: Update app signing and bundle identifiers for production
- Launch the application
- Select your role (Customer or Vendor)
- Enter your email and password
- Tap "Login" to authenticate
- View your chat list on the home screen
- Tap on a chat to open the conversation
- Type your message and tap send
- Messages are delivered in real-time
- Messages are stored locally for offline access
- Automatic synchronization when connection is restored
- Seamless offline-to-online transition
- Follow Flutter and Dart style guidelines
- Use meaningful variable and function names
- Add comprehensive comments for complex logic
- Maintain consistent indentation and formatting
# Run unit tests
flutter test
# Run widget tests
flutter test test/widget_test.dart
# Run specific test file
flutter test test/api_test.dartflutter build apk --releaseflutter build ios --releaseflutter build web --release- Build release APK:
flutter build apk --release - APK location:
build/app/outputs/flutter-apk/app-release.apk - Test on multiple devices before distribution
- Build release:
flutter build ios --release - Archive in Xcode
- Upload to App Store Connect
- Check internet connectivity
- Verify server URL configuration
- Check firewall settings
- Verify API endpoint URLs
- Check network connectivity
- Review API response format
- Run
flutter cleanandflutter pub get - Check Flutter and Dart versions
- Verify platform-specific configurations
Enable debug logging by setting debugPrint statements throughout the codebase.
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Contact the development team
- Check the documentation and troubleshooting guide
- Initial release with basic chat functionality
- Customer and vendor authentication
- Real-time messaging with Socket.IO
- Offline support and local storage
- Modern Material Design 3 UI
Built with ❤️ using Flutter and Dart