Flutter Lens
v0.1.0-alpha.6Render Flutter widgets to real PNGs for coding agents, locally and without an emulator.
Let your coding agent see the Flutter UI it builds. 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.
Summary extracted from the README.
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.
From source code to visual evidence
- Render existing screens and widgets.
- Inspect the actual image, not a guessed layout.
- Find clipping and layout issues.
- Compare changes and test multiple viewports.
Edit → Render → Inspect → Improve
Developer preview. Start with the published Alpha 6 release. The default branch contains newer development features. See releases for the latest verified package.
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.6 --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.6.
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=flutter-lens-dev@0.1.0-alpha.6 flutter-lens doctor
npx --yes --package=flutter-lens-dev@0.1.0-alpha.6 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
| Capability | Use it for |
|---|---|
| Headless PNG rendering | See the actual Flutter layout without starting an app |
| Device and theme matrix | Check compact phones, larger screens and light/dark themes |
| Preview fixtures | Supply mock data, providers, app themes and isolated state |
| Layout diagnostics | Identify potentially truncated text and small or unlabeled semantic tap targets |
| Pixel comparison | Review changes against a matching-size reference PNG |
| Local CLI and MCP | Use images and structured results in your preferred agent |
All six capabilities are included in the published Alpha 6. The newer development branch adds bounded widget interactions, element geometry, reference review, reusable state cases and synthetic text-scale, RTL and safe-area conditions. See development status, rather than assuming unreleased features are available in the pinned package.
Compatibility
| Host or framework | Status |
|---|---|
| Flutter · Linux, Windows, macOS | Actual rendering verified |
| Claude Code, Codex, Cursor, Antigravity | Skill installer targets; four-client installation tests on the development branch |
| Other Agent Skills-compatible hosts | Portable skill; compatibility depends on host capabilities |
| MCP clients | Local stdio server with image responses and SDK smoke tests |
| SwiftUI · macOS / Jetpack Compose · Android Layoutlib | Experimental fixture-based renderers |
| General React Native | Research 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
- Usage guide — CLI, fixtures, matrix, comparison and troubleshooting
- Agent skill — agent-facing workflow and safe execution
- Architecture — renderer design and adapter boundaries
- Roadmap · Changelog · Releases
The published package contains a local stdio MCP server. For Codex:
codex mcp add flutter-lens -- npx --yes --package=flutter-lens-dev@0.1.0-alpha.6 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.