A Flutter chat application with AI integration using GROQ API. Built with clean architecture, BLoC state management, and dependency injection.
ScreenRecording_08-15-2025.10-27-25_1.MP4
- GROQ AI Integration: Real-time chat with GROQ's LLaMA model
- Text-Only Chat: Send and receive text messages only
- Clean Architecture: Feature-based folder structure with dependency injection
- BLoC State Management: Reactive state management with flutter_bloc
- Message Distinction: Clear visual distinction between user and AI messages
- Send Restrictions: Disabled send button while waiting for AI response
- Modern UI: Material 3 design with light/dark theme support
- Environment Configuration: Secure API key management with .env files
lib/
├── core/ # Shared application core
│ ├── config/
│ │ └── app_config.dart # Application configuration
│ ├── constants/
│ │ └── app_constants.dart # App-wide constants
│ ├── di/
│ │ └── service_locator.dart # GetIt dependency injection setup
│ └── theme/
│ └── app_theme.dart # Material 3 theme configuration
├── features/ # Feature-based modules
│ └── chat/
│ ├── bloc/ # State management
│ │ ├── chat_bloc.dart # BLoC implementation
│ │ └── chat_event.dart # Chat events
│ ├── models/ # Data models
│ │ ├── message.dart # Message entity
│ │ └── chat_state.dart # Chat state model
│ ├── screens/ # UI screens
│ │ └── chat_screen.dart # Main chat interface
│ ├── services/ # Business logic
│ │ └── message_service.dart # GROQ API service
│ └── widgets/ # Reusable UI components
│ ├── chat_input.dart # Message input component
│ ├── message_bubble.dart # Message display component
│ └── message_list.dart # Messages list with scroll
└── main.dart # App entry point & DI initialization
- Feature-Based Organization: Each feature is self-contained with its own models, services, and UI
- Dependency Injection: GetIt service locator for singleton management
- Environment Configuration: Secure API key management with flutter_dotenv
- BLoC Pattern: Reactive state management with clear separation of concerns
- Repository Pattern: Abstract service interfaces for testability
flutter_bloc
: Reactive state managementget_it
: Dependency injection service locatorflutter_dotenv
: Environment variable managementhttp
: HTTP client for API calls
equatable
: Value equality for modelsuuid
: Unique message ID generationintl
: Date/time formatting
- Flutter SDK 3.6.2+
- GROQ API key (Get one here)
-
Clone and install dependencies:
cd it_3264_groq flutter pub get
-
Configure environment:
# Edit .env file and add your GROQ API key GROQ_API_KEY=your_actual_groq_api_key_here
-
Run the app:
flutter run
- Text Chat: Type your message in the input field and tap send to chat with GROQ AI
- Real-time Responses: Watch the typing indicator while GROQ generates responses
- Message History: View conversation history with timestamps
- Clear Chat: Use the refresh button in the app bar to start a new conversation
- ChatBloc: Manages conversation state and AI interactions
- ChatEvent: Defines user actions (send message, clear chat, etc.)
- ChatState: Immutable state with message history and loading states
- GetIt: Singleton service registration and dependency resolution
- GroqMessageService: Handles communication with GROQ API
- LLaMA Model: Uses llama-3.1-70b-versatile model
- Error Handling: Graceful degradation for API failures
- Rate Limiting: Built-in request management
- Environment Variables: API keys stored securely in .env files
- Git Ignored: Sensitive data excluded from version control
- Message Distinction: Different colors and alignments for user vs AI messages
- Send Button State: Disabled while waiting for AI response
- Typing Indicator: Animated dots showing AI is responding
- Empty State: Helpful onboarding when chat is empty
- Package Name:
com.extrawest.okholiavko.groq
- App Name: GROQ Chat
- Version: 1.0.0+1
- Themes: Modify
AppTheme
incore/theme/app_theme.dart
- Colors: Update
AppColors
class for custom message styling - Constants: Adjust UI constants in
core/constants/app_constants.dart
- Model Selection: Change GROQ model in
AppConstants.groqModel
- API URL: Modify endpoint in
AppConstants.groqApiUrl
- Response Handling: Customize AI response processing in
GroqMessageService
- Message Search: Find previous conversations
- Export Chat: Save conversations as text files
- Message Reactions: Add emoji reactions to messages
- Voice Input: Speech-to-text integration
- Multiple Conversations: Support for multiple chat sessions
- Offline Support: Local message caching
- Performance: Message virtualization for large conversations
- Testing: Unit and integration test coverage
- CI/CD: Automated build and deployment pipeline
This project is licensed under the BSD-3-Clause license License - see the LICENSE file for details.
Created by Oleksandr Kholiavko
Extrawest.com, 2025