form_engine
A headless, controller-free, declarative form engine for Flutter & Dart.
form_engine helps you manage form state and validation without coupling your logic to widgets, controllers, or a specific state management solution.
โจ Why form_engine?
Flutter already has form libraries โ but most of them are:
- Widget-first
- Hard to unit test
- Tightly coupled to UI
- Difficult to use in clean architecture or enterprise apps
form_engine is different.
It is:
- ๐ง State-first
- ๐งฉ UI-agnostic
- ๐งช Pure Dart core
- ๐ Clean-architecture friendly
๐ Key Features
- Headless form engine (no widgets required)
- Controller-free API
- Declarative form & field schemas
- Composable validators
- Centralized form state
- Easy unit testing
- Works with Bloc, Riverpod, MVC, or setState
๐ฆ Installation
dependencies:
form_engine: ^0.0.1
Basic Usage
final schema = FormSchema(
fields: {
'email': FieldSchema<String>(
validators: const [
RequiredValidator(),
EmailValidator(),
],
),
'password': FieldSchema<String>(
validators: const [
RequiredValidator(),
MinLengthValidator(6),
],
),
},
);
Create the engine
final form = FormEngine(schema: schema);
Update values
form.updateValue('email', 'test@example.com');
form.updateValue('password', '123456');
Validate and read state
form.validateAll();
form.state.values;
form.state.errors;
form.state.isValid;