copyWith method

FieldState<T> copyWith({
  1. T? value,
  2. String? errorText,
  3. FieldValidator<T>? validator,
  4. bool clearError = false,
})

Implementation

FieldState<T> copyWith({
  T? value,
  String? errorText,
  FieldValidator<T>? validator,
  bool clearError = false,
}) {
  return FieldState<T>(
    value: value ?? this.value,
    errorText: clearError ? null : errorText ?? this.errorText,
    validator: validator ?? this.validator,
  );
}