copyWith method
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,
);
}