FormMapper class
A FormMapper is used to bind field values to form elements
- Available extensions
Constructors
- FormMapper({required dynamic instance, bool twoWay = false})
-
Create a new FormMapper
instancethe source instance whose fields will be boundtwoWayiftrue, modifications will immediately modify the instance
Properties
- changes ↔ int
-
getter/setter pair
- dirtyWidgets ↔ int
-
getter/setter pair
- emitOnChange ↔ bool
-
getter/setter pair
- emitOnDirty ↔ bool
-
getter/setter pair
-
eventStream
→ StreamController<
FormEvent> -
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- instance ↔ dynamic
-
getter/setter pair
- isDirty → bool
-
no setter
- isTouched → bool
-
no setter
- isValid → bool
-
no setter
-
operations
→ List<
Operation< ValuedWidgetContext> > -
final
-
properties
→ Map<
String, TypeProperty> -
final
- rootProperty ↔ RootProperty?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transformer ↔ Transformer
-
getter/setter pair
- twoWay → bool
-
final
- type ↔ TypeDescriptor
-
getter/setter pair
-
widgetBindings
→ Map<
String, WidgetProperty> -
final
Methods
-
addDirty(
int delta) → void -
addListener(
void onData(FormEvent event), {dynamic emitOnDirty = false, dynamic emitOnChange = false}) → StreamSubscription -
bind(
String name, {required String path, required BuildContext context, Keywords? args}) → Widget -
bind a field to a form element
namethe element namepatha field pathcontextthe BuildContextargsany parameters that will be passed to the newly created element -
checkbox(
{required String path, required BuildContext context}) → Widget -
Available on FormMapper, provided by the BindCheckbox extension
-
commit<
T> () → T - commit all pending changes to the instance and return it
-
computeProperty(
TypeDescriptor typeDescriptor, String path) → TypeProperty -
date(
{required String path, required BuildContext context, DateTime? firstDate, DateTime? lastDate, String? label, DateFormat? dateFormat}) → Widget -
Available on FormMapper, provided by the DatePickerFormFieldExtension extension
-
dispose(
) → void -
findWidgetById(
String id) → WidgetProperty? -
getKey(
) → GlobalKey< FormState> - return the GlobalKey of the form.
-
getValue<
T> (TypeProperty property) → T -
map(
{required TypeProperty property, required Object widget, required ValuedWidgetAdapter adapter, DisplayValue displayValue = identity, ParseValue parseValue = identity}) → void -
markDirty(
bool dirty) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyChange(
{required TypeProperty property, required dynamic value}) → void -
rollback(
) → void - rollback all changes
-
setValue(
dynamic object) → void -
set the instance that will provide values
valuean instance -
slider(
{required String path, required BuildContext context, required int min, required int max}) → Widget -
Available on FormMapper, provided by the BindSlider extension
-
Switch(
{required String path, required BuildContext context}) → Widget -
Available on FormMapper, provided by the BindSwitch extension
-
text(
{required String path, required BuildContext context, String? prefix, String? placeholder, TextStyle? style, EdgeInsetsGeometry? padding}) → Widget -
Available on FormMapper, provided by the BindText extension
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
) → bool -
return
Trueif the form is valid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited