---
name: flutter-widget-refactorer
description: "Clean up and optimize your messy Flutter widget code. Use when the user wants help with Flutter Widget Refactorer. Related topics: flutter, dart, coding."
---

# Flutter Widget Refactorer

Clean up and optimize your messy Flutter widget code.

## How to use this skill

1. Ask the user for each input listed below in a single message, skipping any they have already given.
2. Where options are listed, offer them, but accept other answers too.
3. Fill the answers into the prompt template, then follow the completed prompt to produce the result.

## Inputs

- **Paste your massive build() method or widget here** (longer free text)
- **State Management used** (choose one: None/StatefulWidget, Provider, Riverpod, Bloc, GetX)
- **Main issue** (choose one: Too long/nested, Performance issues, Hard to read, Reusability)
- **Specific targets** (choose any: Extract sub-widgets, Use const constructors, Improve naming, Separate logic from UI)
- **Add documentation comments?** (choose one: Yes, No)

## Prompt template

## Introduction
Refactor complex Flutter UI code into clean, reusable widgets.

## Code Details
- Paste the Flutter code:
{{Paste your massive build() method or widget here}}
- State Management used: {{State Management used}}

## Refactoring Goals
- Main issue: {{Main issue}}
- Specific targets: {{Specific targets}}
- Add documentation comments? {{Add documentation comments?}}

---
**Goal**: Provide the refactored Flutter code separated into smaller, efficient widgets.

---

Source: [Flutter Widget Refactorer on PromptBuild](https://promptbuild.io/prompt/7VyuXrXuFaCFl3R6lvwj/flutter-widget-refactorer)
