Model-driven forms and validation for Flutter
open sourceMITfree
reactive_forms is a Flutter package for building forms the model-driven way, inspired by Angular's Reactive Forms. You describe a form as FormGroups, FormArrays and FormControls with their validators (predefined, custom, pattern, group-level and asynchronous with debounce), bind them to reactive widgets, and read or set the whole form's value from code. It handles dynamic forms, nested groups, custom error messages and when errors show, and enabling a submit button only when the form is valid.
Problems it solves
- validate a sign-up form in my Flutter app without a pile of setState calls
- check that a password and its confirmation match in a Flutter form
- build a Flutter form whose fields are added and removed at runtime
Features
- FormGroup, FormArray and FormControl models with a FormBuilder
- predefined, custom, pattern, group and async validators with debounce
- reactive form widgets bound to controls
- customisable validation messages and when they appear
- dynamic forms with FormArray
