useForm<F extends FormSchema> function
A hook that provides a FormFieldsController to manage form field states.
The FormFieldsController is a Listenable that can be used to listen to changes in the form field states and created from a FormSchema instance.
Be aware that this hook is a flutter_hooks
hook and needs to be used
inside a HookWidget
. For more information about flutter_hooks
, please
refer to the flutter_hooks documentation.
Implementation
FormFieldsController<F> useForm<F extends FormSchema>({
required F formSchema,
}) {
final controller = useMemoized(
() {
return FormFieldsController<F>(
GlobalKey<FormState>(debugLabel: 'FormFieldsController'),
formSchema,
);
},
);
return useListenable(controller);
}