wishtohear/bucket-water-oms/flutter-building-forms
Claude Code and agent skill by wishtohear/bucket-water-oms
- community
Checking that the SKILL.md file is still in the repository.
Builds Flutter forms with validation and user input handling. Use when creating login screens, data entry forms, or any multi-field user input.
Install
npx vskill@latest install wishtohear/bucket-water-oms/flutter-building-formsSKILL.md
Building Validated Forms
Contents
Form Architecture
Implement forms using a Form widget to group and validate multiple input fields together.
- Use a StatefulWidget: Always host your
Forminside aStatefulWidget. - Persist the GlobalKey: Instantiate a
GlobalKey<FormState>exactly once as a final variable within theStateclass. Do not generate a newGlobalKeyinside thebuildmethod; doing so is resource-expensive and destroys the form's state on every rebuild. - Bind the Key: Pass the
GlobalKey<FormState>to thekeyproperty of theFormwidget. This uniquely identifies the form and provides access to theFormStatefor validation and submission. - Alternative Access: If dealing with highly complex widget trees where passing the key is impractical, use
Form.of(context)to access theFormStatefrom a descendant widget.
Field Validation
Use TextFormField to render Material Design text inputs with built-in validation support. TextFormField is a convenience widget that automatically wraps a standard TextField inside a FormField.
- Implement the Validator: Provide a
validator()callback function to eachTextFormField. - Return Error Messages: If the user's input is invalid, return a
Stringcontaining the specific error message. TheFormwill automatically rebuild to display this text below the field. - Return Null for Success: If the input passes validation, you must return
null.
Workflow: Implementing a Validated Form
Follow this sequential workflow to implement and validate a form. Copy the checklist to track your progress.
Task Progress:
- [ ] 1. Create a
StatefulWidgetand its correspondingStateclass. - [ ] 2. Instantiate
final _formKey = GlobalKey<FormState>();in theStateclass. - [ ] 3. Return a
Formwidget in thebuildmethod and assignkey: _formKey. - [ ] 4. Add
TextFormFieldwidgets as descendants of theForm. - [ ] 5. Write a
validatorfunction for eachTextFormField(returnStringon error,nullon success). - [ ] 6. Add a submit button (e.g.,
ElevatedButton). - [ ] 7. Implement the validation check in the button's
onPressedcallback using_formKey.currentState!.validate().
Validation Decision Logic
When the user triggers the submit action, execute the following conditional logic:
- Call
_formKey.currentState!.validate(). - If `true` (Valid): All validators returned
null. Proceed with form submission (e.g., save data, make API call) and display a success indicator (e.g., aSnackBar). - If `false` (Invalid): One or more validators returned an error string. The
FormStateautomatically rebuilds the UI to display the error messages. - Feedback Loop: Run validator -> review errors -> fix. The user must adjust their input and resubmit until
validate()returnstrue.
Examples
Complete Validated Form Implementation
Use the following pattern to implement a robust, validated form.
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 repositoryCheckingbucket-water-oms-admin-mobile/skills/flutter-building-forms/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/wishtohear/bucket-water-oms/flutter-building-forms)