copyWith method

  1. @override
RadioButtonFieldState<T> copyWith({
  1. T? value,
  2. String? error,
  3. String? label,
  4. bool? touched,
  5. bool? validateOnUpdate,
  6. List<ValidationRule<T>>? rules,
})
override

Creates a new FormFieldState object by copying the existing state and replacing the specified fields with new values.

This method returns a new object that has the same state as the current object, except with the updated fields.

value The new value for the form field. error The new error string for the form field. label The new label string for the form field. touched The new boolean value indicating whether the field has been touched. validateOnUpdate The new boolean value to indicate whether to validate on update. rules The new list of ValidationRule objects for the form field.

Returns a new FormFieldState object with updated fields.

Implementation

@override
RadioButtonFieldState<T> copyWith({
  T? value,
  String? error,
  String? label,
  bool? touched,
  bool? validateOnUpdate,
  List<ValidationRule<T>>? rules,
}) {
  return RadioButtonFieldState<T>(
    value ?? this.value,
    label: label ?? this.label,
  );
}