Flutter Lens

Render Flutter widgets to local PNGs for coding agents. Compare screenshots and inspect layout diagnostics without launching an emulator.

दस्तावेज़

Flutter Lens

Let your coding agent see the Flutter UI it builds.

Verification npm prerelease GitHub release MIT license

Quick start · Features · Usage · Compatibility · Contribute

Flutter Lens renders actual Flutter widgets into PNG screenshots on your machine, without launching an emulator, phone or browser. It gives AI coding agents visual feedback while they build and refine mobile interfaces.

Four-stage Flutter Lens demonstration: render a savings dashboard, detect truncated text, correct the layout, and compare the real screenshots.

Actual Flutter renders · scripted walkthrough · Reproduce · Before · After · Evidence

Edit → Render → Inspect → Improve. Get visual evidence for each change instead of guessing from source code.

Developer preview. Alpha 10 passed all twelve verification jobs and is available through GitHub. Use the pinned GitHub release below. The npm next tag still serves Alpha 6.

Quick start

Requirements: Flutter SDK on PATH, Node.js 22.20+ for the skills installer, and an image-capable coding agent. The bundled renderer itself requires Node.js 20+. No separate MCP server or repository clone is required.

1. Install the skill

npx skills add mullermnm/flutter-lens@v0.1.0-alpha.10 --skill flutter-lens --agent '*' -g -y

The installer supports Claude Code, Codex, Cursor, Antigravity and other compatible hosts. Reload your agent if needed. Omit -g for a project-only installation. To try the latest development skill, omit @v0.1.0-alpha.10.

2. Open your Flutter project and ask your agent

Build a clean dashboard, render it with Flutter Lens, inspect the screenshot, and fix any visual issues.

The agent can use the bundled renderer to discover the widget, produce a screenshot and iterate. You can also ask it to preview an existing screen before editing it.

Prefer a terminal?

From the root of a trusted Flutter project:

npx --yes --package=https://github.com/mullermnm/flutter-lens/releases/download/v0.1.0-alpha.10/flutter-lens-dev-0.1.0-alpha.10.tgz flutter-lens doctor
npx --yes --package=https://github.com/mullermnm/flutter-lens/releases/download/v0.1.0-alpha.10/flutter-lens-dev-0.1.0-alpha.10.tgz flutter-lens render --trusted --file lib/screens/home.dart --widget HomePage

Replace the file and widget with your own. The command returns the absolute path of the real PNG. Open that image to inspect the result. Use --out preview.png to save it to a new file.

What it does

CapabilityUse it for
Headless PNG renderingSee the actual Flutter layout without starting an app
Device and theme matrixCheck compact phones, larger screens and light/dark themes
Preview fixturesSupply mock data, providers, app themes and isolated state
Layout diagnosticsIdentify potentially truncated text and small or unlabeled semantic tap targets
Pixel comparisonReview changes against a matching-size reference PNG
Local CLI and MCPUse images and structured results in your preferred agent

Alpha 10 finds shared dependency configuration in Dart Pub workspace members, reports missing Flutter test dependencies in doctor, and exposes flutter-lens --version. See the verification run and development status.

Compatibility

Host or frameworkStatus
Flutter · Linux, Windows, macOSActual rendering verified
Claude Code, Codex, Cursor, AntigravityVerified skill installation and actual render in CI for all four; live agent behavior unverified
Other Agent Skills-compatible hostsPortable skill; compatibility depends on host capabilities
MCP clientsLocal stdio server with image responses and SDK smoke tests
SwiftUI · macOS / Jetpack Compose · Android LayoutlibExperimental fixture-based renderers
General React NativeResearch only; not a supported renderer

Actual autonomous skill selection and visual reasoning in live agent sessions are not yet verified. The skill is a useful workflow, not a mechanism to force tool invocation. See agent compatibility and verification evidence.

Documentation

Optional: install the MCP server

The published package contains a local stdio MCP server. For Codex:

codex mcp add flutter-lens -- npx --yes --package=https://github.com/mullermnm/flutter-lens/releases/download/v0.1.0-alpha.10/flutter-lens-dev-0.1.0-alpha.10.tgz flutter-lens-mcp --root /absolute/path/to/project --trusted-workspace

For Claude Code, replace codex with claude. Other clients can configure the same command and arguments in their local MCP settings. Replace the path with your own trusted project. Use the skill alone if you do not need MCP.

How it works

Flutter Lens creates a temporary Flutter widget-test harness around the target widget or your explicit preview fixture. Flutter's rendering engine paints the widget tree, then Lens captures a PNG and removes the harness. The agent can inspect the image using its existing image tools and iterate on source code.

Trust and limitations

Render only projects you trust: the renderer executes local project code with your permissions. It is not a sandbox. No cloud service or telemetry is included. Native platform views, plugins, fonts, system behavior and complex startup may differ from an actual phone. Complex screens may require an isolated fixture. Flutter Lens complements, rather than replaces, device and integration tests. See SECURITY.md.

Contributing

We welcome reproducible render failures, realistic fixtures, accessibility improvements, cross-platform tests and agent compatibility reports.

Start with CONTRIBUTING.md, or open an issue. Include your Flutter and Node versions, a minimal nonprivate example, expected behavior and the actual error or screenshot. For local development:

git clone https://github.com/mullermnm/flutter-lens.git
cd flutter-lens
npm run lint
npm test
npm run test:flutter

The last command requires Flutter and produces actual screenshot evidence. See development and release instructions for maintainer workflows.

License

MIT — free to use, modify and contribute to.