copyWith method

Country copyWith({
  1. String? name,
  2. String? dialCode,
  3. String? code,
})

copyWith is a function that returns a new instance of the class with the same properties as the original instance, except for the properties that are explicitly overridden

Args: name (String): The name of the country. dialCode (String): The country's dial code. code (String): The country code.

Returns: A new Country object with the same values as the original Country object, except for the values that are passed in as arguments.

Implementation

Country copyWith({
  String? name,
  String? dialCode,
  String? code,
}) {
  return Country(
    name: name ?? this.name,
    dialCode: dialCode ?? this.dialCode,
    code: code ?? this.code,
  );
}