copyWith method

FieldState<T> copyWith({
  1. T? value,
  2. String? error,
  3. bool? touched,
  4. bool? isValid,
})

Implementation

FieldState<T> copyWith({
  T? value,
  String? error,
  bool? touched,
  bool? isValid,
}) {
  return FieldState<T>(
    value: value ?? this.value,
    error: error, // Error can be nullified, so strictly pass it
    touched: touched ?? this.touched,
    isValid: isValid ?? this.isValid,
  );
}