flutter_ai_chat 0.0.1 copy "flutter_ai_chat: ^0.0.1" to clipboard
flutter_ai_chat: ^0.0.1 copied to clipboard

AI chat interface with streaming responses and conversation management

Flutter AI Chat #

A modern, cross-platform AI chat interface built with Flutter that supports streaming responses and conversation management.

Features #

  • πŸ€– AI Chat Interface - Chat with AI models using OpenAI API
  • πŸ“± Cross-Platform Support - Works on iOS, Android, Web, Windows, macOS, and Linux
  • 🌊 Streaming Responses - Real-time AI responses with streaming support
  • πŸ’¬ Conversation Management - Create, manage, and organize chat conversations
  • 🎨 Modern UI/UX - Beautiful Material Design 3 interface with light/dark themes
  • πŸ“± Responsive Design - Adapts to different screen sizes and orientations
  • πŸ”’ Secure - Secure API key management and data handling
  • ⚑ WASM Compatible - WebAssembly support for web platform
  • πŸ§ͺ High Quality - Analyzed with Pana, Flutter analyze, and Dart analysis

Screenshots #

Screenshots will be added here

Platform Support #

Platform Status Notes
iOS βœ… Supported iPhone and iPad
Android βœ… Supported Phone and Tablet
Web βœ… Supported Chrome, Firefox, Safari, Edge
Windows βœ… Supported Desktop
macOS βœ… Supported Desktop
Linux βœ… Supported Desktop

Getting Started #

Prerequisites #

  • Flutter SDK: ^3.16.0
  • Dart SDK: ^3.2.0
  • OpenAI API Key (for AI functionality)

Installation #

  1. Clone the repository:
git clone https://github.com/Dhia-Bechattaoui/flutter_ai_chat.git
cd flutter_ai_chat
  1. Install dependencies:
flutter pub get
  1. Configure your OpenAI API key:

    • Create a .env file in the root directory
    • Add your API key: OPENAI_API_KEY=your_api_key_here
  2. Run the app:

flutter run

Web Deployment #

For web deployment with WASM support:

flutter build web --web-renderer canvaskit

Configuration #

Environment Variables #

Create a .env file in the root directory:

OPENAI_API_KEY=your_openai_api_key_here

API Configuration #

The app is configured to use OpenAI's GPT models by default. You can modify the configuration in lib/services/ai_service.dart.

Architecture #

The project follows a clean architecture pattern with the following structure:

lib/
β”œβ”€β”€ main.dart                 # App entry point
β”œβ”€β”€ models/                   # Data models
β”‚   β”œβ”€β”€ chat_message.dart    # Chat message model
β”‚   └── conversation.dart    # Conversation model
β”œβ”€β”€ providers/               # State management
β”‚   └── chat_provider.dart  # Chat state provider
β”œβ”€β”€ screens/                 # UI screens
β”‚   └── chat_screen.dart    # Main chat interface
β”œβ”€β”€ services/                # Business logic
β”‚   └── ai_service.dart     # AI API service
β”œβ”€β”€ utils/                   # Utilities
β”‚   └── theme.dart          # App theme configuration
└── widgets/                 # Reusable widgets
    β”œβ”€β”€ chat_input_widget.dart
    β”œβ”€β”€ chat_message_widget.dart
    └── sidebar_widget.dart

Dependencies #

Core Dependencies #

  • flutter - Flutter SDK
  • provider - State management
  • http - HTTP client for API calls
  • shared_preferences - Local storage
  • flutter_markdown - Markdown rendering

Development Dependencies #

  • flutter_lints - Code quality rules
  • flutter_test - Testing framework
  • mockito - Mocking for tests
  • dartdoc - Documentation generation

Quality Assurance #

This project maintains high code quality standards:

  • βœ… Pana Analysis - Full score compliance
  • βœ… Flutter Analyze - No analysis issues
  • βœ… Dart Analysis - Clean code standards
  • βœ… Linting - Strict linting rules
  • βœ… Testing - Comprehensive test coverage

Contributing #

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Testing #

Run the test suite:

flutter test

Run with coverage:

flutter test --coverage

Building for Production #

Android #

flutter build apk --release

iOS #

flutter build ios --release

Web #

flutter build web --release --web-renderer canvaskit

Desktop #

flutter build windows --release
flutter build macos --release
flutter build linux --release

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments #

  • Flutter team for the amazing framework
  • OpenAI for providing the AI API
  • Material Design team for the design system
  • All contributors and supporters

Support #

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Contact the maintainer: Dhia-Bechattaoui

Roadmap #

  • ❌ Voice input support
  • ❌ Image generation integration
  • ❌ Multi-language support
  • ❌ Offline mode
  • ❌ Advanced conversation analytics
  • ❌ Plugin system for custom AI providers

Made with ❀️ using Flutter