Skip to content

surajshekhar/StreamChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Chat App

A Flutter-based AI chat application powered by the Google Gemini API. The application provides a modern conversational interface with real-time streaming responses, multi-session chat management, and a clean architecture designed for scalability and maintainability.

Features

Chat Experience

  • Real-time streaming responses
  • Chat interface with distinct user and AI message bubbles
  • Input field with send button
  • Automatic scrolling to the latest message
  • Typing indicator while the AI generates responses
  • Stop streaming button to halt response generation
  • Copy message button for quick message copying
  • Markdown rendering with proper formatting and code block support

Chat Management

  • Multi-session chat support
  • Sidebar navigation to create and switch between chat sessions
  • Clear chat option
  • Local storage of chat history using shared_preferences

UI and Theming

  • Dark mode and light mode support
  • Responsive and modern chat UI design

Reliability

  • Streaming API integration for real-time updates
  • Robust error handling for network failures, timeouts, and API errors

Architecture

The project follows Clean Architecture principles to ensure separation of concerns, maintainability, and scalability. The codebase is structured into four primary layers:

Presentation Layer (lib/presentation)

Contains the UI components and state management logic, including pages, widgets, and providers responsible for managing UI state and user interactions.

Domain Layer (lib/domain)

Contains the core business logic of the application, including use cases (such as SendMessage) and abstract repository definitions. This layer is independent of frameworks and external libraries.

Data Layer (lib/data)

Responsible for data retrieval and implementation of repository interfaces defined in the domain layer. It includes remote and local data sources such as GeminiRemoteDatasource.

Core Layer (lib/core)

Contains shared utilities, constants, and configurations used across the application, including AppConstants.

State Management

The application uses Provider for state management.

  1. Provider enables efficient sharing and updating of application state across widgets.
  2. It manages chat messages, sessions, and UI updates in a centralized manner.
  3. Widgets listen to state changes and rebuild only when necessary,mproving performance.
  4. This approach helps maintain a clear separation between UI and business logic.

Setup Instructions

  1. Clone the repository.

  2. Install dependencies:

    flutter pub get

Run the app: with your API key flutter run --dart-define=GEMINI_API_KEY="your_api_key_here"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors