Flutter is a cross-platform UI framework that enables building natively compiled applications for mobile, web, and desktop from a single codebase. The Flutter repository is a monorepo containing three major subsystems:
engine/src/flutter/.packages/flutter/.packages/flutter_tools/.This page provides an entry point for understanding how these subsystems are organized and interact within the repository.
Purpose: Introduce the Flutter repository's three-layer architecture (Engine, Framework, Tools), monorepo organization, and how the major systems interact.
Scope:
DEPS vs. Framework pubspec.yaml).Flutter's architecture consists of three distinct layers that work together to enable cross-platform application development:
| Layer | Language | Location | Primary Responsibilities |
|---|---|---|---|
| Engine | C++, Obj-C, Java | engine/src/flutter/ | Impeller rendering, Dart VM, platform channels, compositor, platform integrations engine/src/flutter/shell/common/shell.cc50-151 |
| Framework | Dart | packages/flutter/ | Widget tree, render objects, Material/Cupertino components, semantics, animation |
| Tools | Dart | packages/flutter_tools/ | flutter CLI, hot reload, build orchestration, device management packages/flutter_tools/lib/src/runner/flutter_command.dart164-172 |
This diagram bridges "Natural Language Space" to "Code Entity Space" by mapping architectural components to their implementation files and classes.
Sources:
The repository is structured as a monorepo with distinct directories for each major subsystem.
| Directory | Contents | Key Files/Classes |
|---|---|---|
bin/ | Flutter SDK entry point | bin/flutter, bin/internal/engine.version |
packages/flutter/ | Core framework library | StatefulWidget, RenderObject |
packages/flutter_tools/ | Developer tooling | FlutterCommand packages/flutter_tools/lib/src/runner/flutter_command.dart164 RunCommand packages/flutter_tools/lib/src/commands/run.dart35 |
engine/src/flutter/ | C++ engine source | Shell engine/src/flutter/shell/common/shell.cc59 Engine engine/src/flutter/shell/common/shell.cc59 |
dev/ | CI/CD and Analysis scripts | dev/bots/analyze.dart dev/bots/analyze.dart45 |
This diagram illustrates how data flows from the Framework through the Engine to the platform during a frame.
Sources:
Flutter utilizes two distinct dependency management strategies:
The DEPS file at the root manages third-party C++ and toolchain dependencies via gclient.
skia_revision DEPS19 dart_revision DEPS59 and clang_version DEPS43The engine and tools use Dart's workspace feature for interdependent packages.
engine/src/flutter/pubspec.yaml defines a workspace engine/src/flutter/pubspec.yaml75-82 containing packages like engine_tool, clang_tidy, and testing utilities engine/src/flutter/pubspec.yaml83-111resolution: workspace engine/src/flutter/pubspec.yaml41 and leverage dependency_overrides to point to vendored third-party code in ./third_party/pkg/ engine/src/flutter/pubspec.yaml164-176dev/bots/analyze.dart script is the primary gatekeeper for code quality, running static analysis and custom lint rules dev/bots/analyze.dart45-58 It supports specific validations like render_box_intrinsics and no_double_clamp dev/bots/analyze.dart23-26Flutter Tester and integration tests on physical devices packages/flutter_tools/lib/src/commands/test.dart41-64stable, beta, and main channels CHANGELOG.md1-13 Hotfixes are strictly managed for the stable channel to ensure reliability CHANGELOG.md1-5Sources:
Refresh this wiki
This wiki was recently refreshed. Please wait 3 days to refresh again.