copyWith method
If the caller passes in a value for a parameter, use that value, otherwise use the value of the corresponding field.
Args: large (String): The URL of the large picture. medium (String): The URL of the medium-sized version of the picture. thumbnail (String): The URL of the thumbnail image.
Returns: A new instance of the Picture class with the values of the original instance, but with the values of the parameters if they are not null.
Implementation
Picture copyWith({
String? large,
String? medium,
String? thumbnail,
}) {
return Picture(
large: large ?? this.large,
medium: medium ?? this.medium,
thumbnail: thumbnail ?? this.thumbnail,
);
}