Form constructor

const Form({
  1. Key? key,
  2. required Widget child,
  3. FormSubmitCallback? onSubmit,
  4. FormController? controller,
})

Creates a Form widget.

The child parameter is required and should contain the form fields and UI elements that participate in the form. The controller and onSubmit parameters are optional but commonly used for form management.

Parameters:

  • child (Widget, required): The widget subtree containing form fields
  • onSubmit (FormSubmitCallback?, optional): Callback for form submission
  • controller (FormController?, optional): External form state controller

Example:

Form(
  onSubmit: (values) => print('Submitted: $values'),
  child: Column(
    children: [
      TextInput(key: FormKey('email'), label: 'Email'),
      Button(child: Text('Submit')),
    ],
  ),
);

Implementation

const Form({super.key, required this.child, this.onSubmit, this.controller});