# flutter/flutter-intellij architecture

> Architecture diagram of the GitHub repository flutter/flutter-intellij, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/flutter/flutter-intellij
- Repository: https://github.com/flutter/flutter-intellij

## Overview

##### Main Components

a. Core Plugin Infrastructure:
- FlutterInitializer and ProjectOpenActivity (entry points)
- FlutterSettings and Configuration Management
- Plugin Services and Extensions

b. Development Tools Integration:
- Flutter SDK Integration
- Dart Language Support
- Build/Run Configuration System
- Debug Infrastructure

c. UI Components:
- Editor Integration
- Tool Windows
- Action System
- Inspector Views
- Console Output

d. External Services Integration:
- DevTools Integration
- VM Service Integration
- Android/iOS Tooling

##### Component Relationships

**[IntelliJ Platform] ←→ [Flutter Plugin Core]**
- ↑                     ↓
**[Editor Extensions]    [Flutter SDK Integration]**
- ↑                     ↓
**[UI Components] ←→ [Development Tools]**
- ↓                     ↓
**[Action System] →  [External Services]**

##### Specific Implementation Details

Key subsystems:
- Daemon API integration (run/debug)
- Hot reload functionality
- Inspector integration
- Build system integration
- Device management
- Project templates

##### Data Flow Indicators

Key interactions:
- Editor → Flutter SDK (code analysis)
- UI → Daemon (development commands)
- Debug Process → VM Service (debugging)
- Inspector → Device (UI inspection)

##### External Dependencies

Integration with:
- Flutter SDK
- Dart SDK
- Android Studio (optional)
- DevTools
- Gradle (for Android)
- Xcode (for iOS)

##### Key Architectural Patterns

Emphasize:
- Service-oriented architecture
- Event-driven communication
- Plugin extension points
- Command pattern (actions)
- Observer pattern (file watchers)

##### Implementation Notes

- Clear separation between UI and service layers
- Modular design for IDE independence
- Extensible architecture for future features
- Clear dependency management

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph IDE
        IDEA[IntelliJ Platform]
        EDITOR[Editor Extensions]:::editor
        UI[UI Components]:::ui
        ACTION[Action System]:::action
    end

    subgraph Core
        INIT[FlutterInitializer]:::core
        SETTINGS[Settings Management]:::core
        PROJECT[Project Activity]:::core
        SERVICES[Plugin Services]:::core
    end

    subgraph DevTools
        SDK[Flutter SDK Integration]:::dev
        DART[Dart Support]:::dev
        BUILD[Build Configuration]:::dev
        DEBUG[Debug System]:::dev
    end

    subgraph UI_Components
        INSPECTOR[Inspector Views]:::ui
        PREVIEW[Preview System]:::ui
        CONSOLE[Console Output]:::ui
        TOOLWINDOWS[Tool Windows]:::ui
    end

    subgraph External
        DEVTOOLS[DevTools Integration]:::ext
        VM[VM Service]:::ext
        ANDROID[Android Tools]:::ext
        IOS[iOS Tools]:::ext
    end

    %% Core relationships
    IDEA --> INIT
    INIT --> SETTINGS
    INIT --> PROJECT
    INIT --> SERVICES

    %% Development tools relationships
    SERVICES --> SDK
    SDK --> DART
    SDK --> BUILD
    SDK --> DEBUG

    %% UI relationships
    EDITOR --> UI
    UI --> INSPECTOR
    UI --> PREVIEW
    UI --> CONSOLE
    UI --> TOOLWINDOWS

    %% Action system relationships
    ACTION --> SDK
    ACTION --> DEVTOOLS
    ACTION --> VM

    %% External service relationships
    DEBUG --> VM
    SDK --> ANDROID
    SDK --> IOS
    INSPECTOR --> DEVTOOLS

    %% Click events
    click INIT "https://github.com/flutter/flutter-intellij/blob/master/flutter-idea/src/io/flutter/FlutterInitializer.java"
    click PROJECT "https://github.com/flutter/flutter-intellij/blob/master/flutter-idea/src/io/flutter/ProjectOpenActivity.java"
    click SETTINGS "https://github.com/flutter/flutter-intellij/blob/master/flutter-idea/src/io/flutter/settings/FlutterSettings.java"
    click SDK "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/sdk/"
    click DART "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/dart/"
    click DEBUG "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/run/"
    click BUILD "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/run/daemon/"
    click EDITOR "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/editor/"
    click ACTION "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/actions/"
    click INSPECTOR "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/view/"
    click PREVIEW "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/preview/"
    click DEVTOOLS "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/devtools/"
    click VM "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/vmService/"
    click ANDROID "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/android/"
    click CONSOLE "https://github.com/flutter/flutter-intellij/tree/master/flutter-idea/src/io/flutter/console/"

    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef dev fill:#4CAF50,stroke:#2E7D32,color:white
    classDef ui fill:#FF9800,stroke:#EF6C00,color:white
    classDef ext fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef editor fill:#607D8B,stroke:#37474F,color:white
    classDef action fill:#FF5722,stroke:#D84315,color:white

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[Development Tools]:::dev
        L3[UI Components]:::ui
        L4[External Services]:::ext
        L5[Editor Integration]:::editor
        L6[Action System]:::action
    end
```
