Form constructor Null safety

const Form(
  1. {Key? key,
  2. required Widget child,
  3. @Deprecated('Use autovalidateMode parameter which provides more specific ' 'behavior related to auto validation. ' 'This feature was deprecated after v1.19.0.') bool autovalidate,
  4. WillPopCallback? onWillPop,
  5. VoidCallback? onChanged,
  6. AutovalidateMode? autovalidateMode}
)

Creates a container for form fields.

The child argument must not be null.

Implementation

const Form({
  Key? key,
  required this.child,
  @Deprecated(
    'Use autovalidateMode parameter which provides more specific '
    'behavior related to auto validation. '
    'This feature was deprecated after v1.19.0.',
  )
  this.autovalidate = false,
  this.onWillPop,
  this.onChanged,
  AutovalidateMode? autovalidateMode,
}) : assert(child != null),
     assert(autovalidate != null),
     assert(
       autovalidate == false ||
       autovalidate == true && autovalidateMode == null,
       'autovalidate and autovalidateMode should not be used together.',
     ),
     autovalidateMode = autovalidateMode ??
       (autovalidate ? AutovalidateMode.always : AutovalidateMode.disabled),
     super(key: key);