copyWith method

ContactValue<T> copyWith({
  1. T? type,
  2. String? description,
  3. String? value,
  4. (String, bool)? isFieldValid,
})

Implementation

ContactValue<T> copyWith({
  T? type,
  String? description,
  String? value,
  (String, bool)? isFieldValid,
}) {
  return ContactValue._(
    key: key,
    type: type ?? this.type,
    description: description ?? this.description,
    value: value ?? this.value,
    // if isFieldValid is not null, update the validFields map
    validFields: isFieldValid != null
        ? {
            ...validFields,
            isFieldValid.$1: isFieldValid.$2,
          }
        : validFields,
  );
}