copyWith method

AddressValue<T> copyWith({
  1. T? type,
  2. String? description,
  3. String? number,
  4. String? street,
  5. String? other,
  6. String? municipality,
  7. String? county,
  8. String? province,
  9. String? postalCode,
  10. String? countryCode,
  11. (String, bool)? isFieldValid,
})

Implementation

AddressValue<T> copyWith({
  T? type,
  String? description,
  String? number,
  String? street,
  String? other,
  String? municipality,
  String? county,
  String? province,
  String? postalCode,
  String? countryCode,
  (String, bool)? isFieldValid,
}) {
  return AddressValue._(
    key: key,
    type: type ?? this.type,
    description: description ?? this.description,
    number: number ?? this.number,
    street: street ?? this.street,
    other: other ?? this.other,
    municipality: municipality ?? this.municipality,
    county: county ?? this.county,
    province: province ?? this.province,
    postalCode: postalCode ?? this.postalCode,
    countryCode: countryCode ?? this.countryCode,
    // if isFieldValid is not null, update the validFields map
    validFields: isFieldValid != null
        ? {
            ...validFields,
            isFieldValid.$1: isFieldValid.$2,
          }
        : validFields,
  );
}