copyWith method

Address copyWith({
  1. String? address1,
  2. String? address2,
  3. String? city,
  4. String? postalCode,
  5. Coordinate? coordinates,
  6. String? state,
})

Return a new Address object with the same values as this one, except for the values that are explicitly overridden.

Args: address1 (String): The first line of the address. address2 (String): address2 ?? this.address2, city (String): The city of the address. postalCode (String): The postal code of the address. coordinates (Coordinate): The coordinates of the address. state (String): The state of the address.

Returns: A new instance of the Address class with the updated values.

Implementation

Address copyWith({
  String? address1,
  String? address2,
  String? city,
  String? postalCode,
  Coordinate? coordinates,
  String? state,
}) {
  return Address(
    address1: address1 ?? this.address1,
    address2: address2 ?? this.address2,
    city: city ?? this.city,
    postalCode: postalCode ?? this.postalCode,
    coordinates: coordinates ?? this.coordinates,
    state: state ?? this.state,
  );
}