agentic-flutter-vertex

๐ŸŒŸ VoiceFlow Diary

Flutter Firebase Vertex AI

**An intelligent diary app powered by voice AI** ๐ŸŽ™๏ธโœจ Transform your thoughts into beautiful diary entries using the power of Google's Gemini AI with real-time voice conversation capabilities. [Documentation / Documentaciรณn (Docusaurus)](/agentic-flutter-vertex/documentation/) โ€ข [Features](#-features) โ€ข [Demo](#-demo)

๐Ÿ“– Overview

VoiceFlow Diary is a next-generation journaling application that combines traditional diary keeping with cutting-edge AI voice technology. Built with Flutter and powered by Firebase Vertex AI (Gemini), it offers multiple ways to capture your daily momentsโ€”from traditional typing to hands-free voice conversations.

๐ŸŽฏ What Makes It Special?


โœจ Features

๐ŸŽ™๏ธ Voice Interaction Modes

VoiceFlow Diary offers three distinct voice interaction modes for maximum flexibility:

1. ๐Ÿ”ฎ Gemini Live Assistant (Real-Time Conversation)

2. ๐ŸŽค Traditional Voice Assistant

3. ๐ŸŽ™๏ธ Voice Note Creation

๐Ÿค– AI Capabilities

Content Analysis

Image Generation

Conversational AI

๐Ÿ’พ Data Management

๐ŸŽจ User Interface


๐ŸŽฌ Demo

Voice Interaction Comparison

Feature Gemini Live Traditional Voice Note
Latency <1 second 3-5 seconds 2-4 seconds
Interaction Continuous Start/Stop Single shot
Response Type Voice Text Processed entry
Best For Natural chat Deliberate commands Quick capture
Network Usage Higher Medium Medium

Screenshots

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐Ÿ“ฑ VoiceFlow Diary                   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                         โ”‚
โ”‚  ๐Ÿ”ฎ  Live Voice Assistant (Large Purple Button)        โ”‚
โ”‚      โ†’ Real-time conversation with Gemini              โ”‚
โ”‚                                                         โ”‚
โ”‚  ๐ŸŽค  Traditional Assistant (Deep Purple)               โ”‚
โ”‚      โ†’ Record โ†’ Process โ†’ Respond                      โ”‚
โ”‚                                                         โ”‚
โ”‚  ๐ŸŽ™๏ธ  Voice Command (Teal)                              โ”‚
โ”‚      โ†’ Quick diary entry creation                      โ”‚
โ”‚                                                         โ”‚
โ”‚  โœ๏ธ  Manual Entry (Primary Color)                      โ”‚
โ”‚      โ†’ Traditional typing                              โ”‚
โ”‚                                                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Installation

Prerequisites

Setup Steps

  1. Clone the repository
    git clone https://github.com/weincoder/agentic-flutter-vertex.git
    cd agentic-flutter-vertex/example
    
  2. Install dependencies
    flutter pub get
    
  3. Configure Firebase
    # Install FlutterFire CLI
    dart pub global activate flutterfire_cli
       
    # Configure Firebase for your project
    flutterfire configure
    
  4. Set up Vertex AI
    • Enable Vertex AI API in Google Cloud Console
    • Enable the following models:
      • gemini-1.5-flash (Chat)
      • gemini-2.0-flash-live-preview-04-09 (Live)
      • imagen-3.0-generate-002 (Images)
  5. Configure permissions

    iOS (ios/Runner/Info.plist):

    <key>NSMicrophoneUsageDescription</key>
    <string>VoiceFlow Diary needs microphone access to record voice notes</string>
    <key>NSSpeechRecognitionUsageDescription</key>
    <string>VoiceFlow Diary uses speech recognition to transcribe your voice</string>
    

    Android (android/app/src/main/AndroidManifest.xml):

    <uses-permission android:name="android.permission.RECORD_AUDIO"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    
  6. Run the app
    # iOS
    flutter run -d ios
       
    # Android
    flutter run -d android
       
    # Web
    flutter run -d chrome
       
    # Desktop
    flutter run -d macos  # or windows, linux
    

๐Ÿ—๏ธ Architecture

Project Structure

lib/
โ”œโ”€โ”€ main.dart                          # App entry point
โ”œโ”€โ”€ config/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ””โ”€โ”€ app.dart                   # Root app widget with Provider
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ”œโ”€โ”€ database_helper.dart       # SQLite database setup
โ”‚   โ”‚   โ””โ”€โ”€ diary_repository.dart      # Data access layer
โ”‚   โ”œโ”€โ”€ firebase/
โ”‚   โ”‚   โ””โ”€โ”€ firebase_options.dart      # Firebase configuration
โ”‚   โ”œโ”€โ”€ ia/
โ”‚   โ”‚   โ”œโ”€โ”€ app_agents/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ diary_agent.dart       # Diary entry AI agent
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ image_generator.dart   # Imagen 3.0 integration
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ voice_assistant_agent.dart  # Voice command processor
โ”‚   โ”‚   โ””โ”€โ”€ models/
โ”‚   โ”‚       โ””โ”€โ”€ ia_models.dart         # AI model configurations
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ””โ”€โ”€ diary_entry.dart           # Data models
โ”‚   โ””โ”€โ”€ state/
โ”‚       โ””โ”€โ”€ app_state.dart             # Global app state (Provider)
โ””โ”€โ”€ ui/
    โ”œโ”€โ”€ pages/
    โ”‚   โ”œโ”€โ”€ diary_home_page.dart       # Main screen
    โ”‚   โ””โ”€โ”€ new_entry_page.dart        # Entry editor
    โ””โ”€โ”€ widgets/
        โ”œโ”€โ”€ entry_card.dart            # Entry display card
        โ”œโ”€โ”€ image_viewer.dart          # Full-screen image viewer
        โ”œโ”€โ”€ live_voice_assistant.dart  # Gemini Live integration
        โ”œโ”€โ”€ voice_assistant_button.dart # Traditional voice assistant
        โ”œโ”€โ”€ voice_command_button.dart  # Voice note creation
        โ””โ”€โ”€ voice_commands_help_dialog.dart # Help dialog

Tech Stack

Core Framework

Firebase & AI

Audio Processing

State Management

Data Persistence

UI & Utilities

Data Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         User Input                          โ”‚
โ”‚            (Voice / Text / Traditional Commands)            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Voice Processing                         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚
โ”‚  โ”‚  Gemini Live โ”‚  โ”‚ Traditional  โ”‚  โ”‚  Voice Note  โ”‚      โ”‚
โ”‚  โ”‚  (Streaming) โ”‚  โ”‚  (Recording) โ”‚  โ”‚  (Capture)   โ”‚      โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
                         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Gemini AI Processing                      โ”‚
โ”‚  โ€ข Transcription  โ€ข Analysis  โ€ข Classification              โ”‚
โ”‚  โ€ข Content Generation  โ€ข Function Calling                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ–ผ               โ–ผ               โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Action โ”‚     โ”‚  Store  โ”‚    โ”‚  Image   โ”‚
    โ”‚ (Theme)โ”‚     โ”‚  Entry  โ”‚    โ”‚  Gen     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚               โ”‚               โ”‚
         โ–ผ               โ–ผ               โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚         App State / Database         โ”‚
    โ”‚   (Provider notifies UI updates)     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
                     โ–ผ
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚ UI Updateโ”‚
               โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key Design Patterns

  1. Singleton Pattern: AI agents are instantiated once
  2. Repository Pattern: Data access abstraction
  3. Provider Pattern: Reactive state management
  4. Factory Pattern: Model creation and initialization
  5. Stream Pattern: Real-time audio streaming (Gemini Live)

๐Ÿ“š Documentation

Additional Guides

Located in /example:

Voice Commands Reference

Theme Commands

"Cambia el color a azul"
"Pon la app en rojo"
"Quiero el tema morado"

Query Commands

"ยฟQuรฉ tiempo hace hoy?"
"ยฟCuรกl es la capital de Francia?"
"Explรญcame quรฉ es la fotosรญntesis"

Diary Commands

"Resume mi semana"
"Muestra un resumen del mes"
"ยฟQuรฉ escribรญ hoy?"

Management Commands

"Elimina la รบltima entrada"
"Borra la entrada de ayer"

API Reference

DiaryAgent

class DiaryAgent {
  // Analyze diary content
  Future<Map<String, dynamic>> analyzeContent(String content);
  
  // Generate entry title
  Future<String> generateTitle(String content);
  
  // Extract emotions
  Future<List<String>> detectEmotions(String content);
  
  // Generate tags
  Future<List<String>> generateTags(String content);
}

VoiceAssistantAgent

class VoiceAssistantAgent {
  // Process voice command
  Future<VoiceCommandResult> processCommand(String audioPath);
  
  // Command types
  enum VoiceCommandType {
    colorChange,
    question,
    summary,
    deleteEntry,
    unknown,
  }
}

LiveVoiceAssistant

class LiveVoiceAssistant {
  // Function declarations for Gemini Live
  - setAppColor(color: String)
  - getDiarySummary(timeRange: String)
  - deleteEntry(target: String)
}

๐ŸŽจ Customization

Theme Colors

The app supports dynamic theming via voice commands. Available colors:

Spanish English Color Code
rojo red Colors.red
azul blue Colors.blue
verde green Colors.green
morado purple Colors.purple
naranja orange Colors.orange
rosa pink Colors.pink
turquesa teal Colors.teal
รญndigo indigo Colors.indigo
cafรฉ brown Colors.brown
รกmbar amber Colors.amber

Voice Configuration

Edit voice settings in live_voice_assistant.dart:

LiveGenerationConfig(
  speechConfig: SpeechConfig(
    voiceName: 'Achernar', // Change voice
  ),
  responseModalities: [ResponseModalities.audio],
)

Available voices: Check Google Cloud TTS documentation

Audio Settings

Modify audio configuration in voice widgets:

RecordConfig(
  encoder: AudioEncoder.pcm16bits,
  sampleRate: 24000,  // Adjust sample rate
  numChannels: 1,     // Mono/Stereo
  echoCancel: true,   // Echo cancellation
  noiseSuppress: true, // Noise suppression
)

๐Ÿ”ง Configuration

Environment Variables

Create a .env file (if needed for future enhancements):

FIREBASE_PROJECT_ID=your-project-id
VERTEX_AI_LOCATION=us-central1

Firebase Configuration

Edit firebase_options.dart after running flutterfire configure:

static const FirebaseOptions currentPlatform = FirebaseOptions(
  apiKey: 'your-api-key',
  projectId: 'your-project-id',
  messagingSenderId: 'your-sender-id',
  appId: 'your-app-id',
  // ... platform-specific options
);

๐Ÿงช Testing

Run Tests

flutter test

Integration Tests

flutter test integration_test/

Analyze Code

flutter analyze

๐Ÿ“Š Performance

Benchmarks

Metric Gemini Live Traditional Voice Note
Response Time <1s 3-5s 2-4s
Token Usage 2-3x higher Medium Medium
Network Bandwidth High (streaming) Medium Medium
Battery Impact Higher Medium Low
Accuracy Excellent Excellent Excellent

Optimization Tips

  1. Use Traditional mode for battery-conscious scenarios
  2. Batch operations when creating multiple entries
  3. Cache images locally to reduce API calls
  4. Limit summary queries to reduce token usage

๐Ÿค Contributing

We welcome contributions! Please follow these guidelines:

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

Code Style


๐Ÿ“ License

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


๐Ÿ™ Acknowledgments


๐Ÿ“ž Support


๐Ÿ—บ๏ธ Roadmap

Version 2.0

Version 3.0


### Made with โค๏ธ using Flutter & Firebase Vertex AI **[โฌ† Back to Top](#-voiceflow-diary)**

agentic-flutter-vertex