utsavsavani08/rain-skill-main/flutter-add-widget-preview
Claude Code and agent skill by utsavsavani08/rain-skill-main
- community
Checking that the SKILL.md file is still in the repository.
Flutter widget preview expert. Load for adding interactive widget previews using the @Preview annotation and previews.dart system — IDE-integrated visual testing without running the full app. Triggers on: widget preview, @Preview, flutter widget-preview, previews.dart, preview annotation, MultiPreview, WidgetPreview.
Install
npx vskill@latest install utsavsavani08/rain-skill-main/flutter-add-widget-previewSKILL.md
The same SKILL.md was published earlier as utsavsavani08/rain-skill-main/flutter-add-widget-preview.
Flutter Widget Preview — Interactive UI Previews
Add@Previewannotations to render widgets in the IDE without launching a device or emulator.
What widget previews are
Widget previews let you view and interact with individual Flutter widgets directly in your IDE (Android Studio, IntelliJ, VS Code 3.38+) using the flutter widget-preview start command. No full app launch required.
Mandatory checkpoint (before adding previews)
@Preview annotation rules
| Allowed targets | Not allowed | |
|---|---|---|
| Top-level functions | Instance methods | |
| Static class methods | dart:io / dart:ffi APIs | |
| Public widget constructors | Platform channels | |
| Public factory constructors | Native-dependent code |
The annotated function must:
- Take no required arguments (or have all defaults provided)
- Return
WidgetorWidgetBuilder
Basic preview
Sized preview (explicit constraints)
Use when the widget needs bounded dimensions to render correctly.
Custom preview class (with transformations)
Extend Preview to apply consistent wrappers — themes, padding, locale.
MultiPreview — generate multiple variants
Use @MultiPreview to automatically produce several previews from a single annotation.
Asset paths in previews
Never use relative or File-based paths. Use package-relative asset paths.
Running previews
Via IDE
- VS Code: Open a file with
@Previewannotations → click "Open Preview" in the editor toolbar - Android Studio / IntelliJ: Gutter icon appears next to preview functions → click to render
Via CLI
Preview iteration loop
Organizing previews
Keeping previews in separate _preview.dart files avoids polluting production code with preview annotations.
Common errors and fixes
| Error | Cause | Fix | |
|---|---|---|---|
| Preview not showing in IDE | Flutter channel not main/master | Switch with flutter channel main | |
dart:io error in preview | Using File, Platform, etc. | Remove native API usage from preview path | |
| Asset not loading | Relative asset path | Use packages/<name>/assets/... format | |
| Preview crashes silently | Exception in widget constructor | Wrap preview body in Builder with error boundary | |
| Callback not working | Non-constant callback passed | Use null or a top-level constant callback |
Hard rules
- No `dart:io` or `dart:ffi` in any code path reachable from a preview.
- No required arguments on preview functions — defaults or constants only.
- Always use package-relative asset paths inside previews.
- Keep preview functions in separate files — don't mix with production logic.
- Never ship preview annotations to production without a clear keep/remove decision.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.rain-skill/skills/flutter-add-widget-preview/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/utsavsavani08/rain-skill-main/flutter-add-widget-preview)