copyWith method
Returns a copy of this object with its field values replaced by the ones provided to this method.
Since rawIdFromEndpoint
and rawIdFromMdns
are nullable, they are
defaulted to empty objects in this method. If left as empty objects, their
current values in this DiscoveredBridge object will be used. This way,
if they are null
, the program will know that they are intentionally
being set to null
.
Implementation
DiscoveredBridge copyWith({
Object? rawIdFromEndpoint = sentinelValue,
Object? rawIdFromMdns = sentinelValue,
String? ipAddress,
}) {
if (!identical(rawIdFromEndpoint, sentinelValue)) {
assert(
rawIdFromEndpoint is String?,
"`rawIdFromEndpoint` must be an `String?` object",
);
}
if (!identical(rawIdFromMdns, sentinelValue)) {
assert(
rawIdFromMdns is String?,
"`rawIdFromMdns` must be an `String?` object",
);
}
return DiscoveredBridge(
rawIdFromEndpoint: identical(rawIdFromEndpoint, sentinelValue)
? this.rawIdFromEndpoint
: rawIdFromEndpoint as String?,
rawIdFromMdns: identical(rawIdFromMdns, sentinelValue)
? this.rawIdFromMdns
: rawIdFromMdns as String?,
ipAddress: ipAddress ?? this.ipAddress,
);
}