compiler library
Compiles analyzed Flutter widget trees into the IR.
FlutterCompiler resolves the app's Material theme (ThemeExtractor), maps widgets to frames and text with a Flutter-like layout model, and extracts the design system: color tokens with Light/Dark values, text and elevation styles, and components (ComponentExtractor).
final analysis = await FlutterProjectAnalyzer('path/to/app').analyze();
final ir = FlutterCompiler().compile(analysis);
Classes
- AppBarThemeSpec
-
The subset of
AppBarThemeDatathe exporter applies. - AssetLookup
- A resolved asset, or the reason there is none.
- CardThemeSpec
-
The subset of
CardThemeDatathe exporter applies. - ComponentExtractor
- Turns the compiler's instance markers into components.
- FlutterCompiler
- Compiles analyzed Flutter widget trees into IrDocuments.
- IconFont
-
Glyph outlines from an icon font, such as Flutter's
MaterialIcons. - IconGlyph
- A glyph outline placed in an icon's box.
- MaterialTheme
-
A resolved Material 3 theme: what
Theme.of(context)would return. - ProjectAssets
-
Finds the image files a Flutter project's asset names refer to, the way
Flutter's asset bundle does: relative to the project (or to a package
for
packages/<name>/...andpackage:arguments), preferring the highest resolution variant (2.0x/,3.0x/folders next to the file). - TextStyleSpec
-
A partially specified Flutter
TextStyle. Unset fields inherit. - ThemeExtractor
-
Recovers the app's
ThemeDatastatically and resolves it the way Flutter does (ThemeDatafactory +Theme.oflocalization), producing the MaterialTheme widgets are compiled against. - ValueEvaluator
-
Interprets analyzed Dart values (
EdgeInsets.all(16),Colors.blue, ...) as design values.
Enums
Constants
-
builtInComponents
→ const Set<
String> - Components the compiler marks on every occurrence (design-system primitives), as opposed to project widgets, which must repeat.
-
m3DarkColorScheme
→ const Map<
String, int> -
m3LightColorScheme
→ const Map<
String, int> -
m3TextTheme
→ const Map<
String, TextStyleSpec>
Functions
-
completeColorScheme(
Map< String, int> given) → Map<String, int> ? -
Fills unset optional roles the way
ColorScheme's getters do. Returns null if a required role is missing. -
describeTheme(
MaterialTheme t) → Map< String, Object?> -
The theme in the same shape as the Flutter ground-truth dump
(
example/test/theme_ground_truth_test.dart), for comparing the static extraction with what Flutter resolves. -
jsonEncodeShadows(
List< IrShadow> shadows) → String -
projectIconFonts(
String root) → Map< String, IconFont> -
The icon fonts a Flutter project at
rootdraws with, by family: Material icons from its Flutter SDK, andCupertinoIconswhen it depends oncupertino_icons. Fonts that can't be found are left out. -
seedColorScheme(
int seedArgb, {required ThemeBrightness brightness, String variant = 'tonalSpot', double contrastLevel = 0, Map< String, int> overrides = const {}}) → Map<String, int> -
ColorScheme.fromSeed: roles come from Material Color Utilities' dynamic scheme, then explicitoverrideswin. -
signature(
IrNode node) → String - What must be identical for two occurrences to share a component variant: everything except text content, provenance, and the root's own size and placement (instances can be resized and positioned).
-
simplify(
IrNode node) → IrNode - Removes structural wrappers that Flutter needs but a designer doesn't:
Typedefs
-
ColorSchemeValue
= ({ThemeBrightness brightness, Map<
String, int> roles}) -
A statically computed
ColorScheme.