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