copyWithNullable method

  1. @override
TextFieldState copyWithNullable({
  1. String? value,
})
override

A null-tolerant version of copyWith, allowing you to explicitly set fields to null.

This is useful for form reset behaviors like clearing a field's value or removing its error.

Implementation

@override
TextFieldState copyWithNullable({
  String? value,
}) {
  _syncController(value);
  return TextFieldState(
    value,
    error: error,
    label: label,
    rules: rules,
    touched: touched,
    validateOnUpdate: validateOnUpdate,
    controller: controller,
    focusNode: focusNode,
  );
}