copyWith method
ChannelState
copyWith({
- int? version,
- DateTime? lastModified,
- Object? walletId = _unset,
- ChannelStatus? status,
- Object? role = _unset,
- Object? clientPeerId = _unset,
- Object? serverPeerId = _unset,
- Object? clientPubKeyHex = _unset,
- Object? serverPubKeyHex = _unset,
- Object? clientAddressB58 = _unset,
- Object? serverAddressB58 = _unset,
- Object? derivationIndex = _unset,
- BigInt? fundingAmountSats,
- Object? fundingTxId = _unset,
- Object? fundingTxHex = _unset,
- Object? fundingOutputIndex = _unset,
- List<
String> ? fundingAncestorTxids, - Object? fundingBeefHex = _unset,
- Object? fundingInputSats = _unset,
- int? fundingBroadcastAttempts,
- bool? fundingBroadcastInFlight,
- Object? fundingBroadcastError = _unset,
- bool? fundingRecordedInWallet,
- bool? fundingSent,
- bool? fundingFailed,
- Object? lockTimeUnix = _unset,
- Object? refundTxHex = _unset,
- Object? refundClientSigHex = _unset,
- Object? refundServerSigHex = _unset,
- Object? signedRefundTxHex = _unset,
- BigInt? clientBalanceSats,
- BigInt? serverBalanceSats,
- int? latestSequenceNumber,
- Object? latestPaymentTxHex = _unset,
- Object? latestPaymentTxId = _unset,
- Object? latestClientSignatureHex = _unset,
- bool? returnLegRecordedInWallet,
- Object? context = _unset,
- Object? counterpartyMarker = _unset,
- Object? createdAt = _unset,
- Object? refundClaimedTxId = _unset,
- Object? closedAt = _unset,
A copy of this state with the given fields replaced. The nullable
fields take an explicit null (e.g. fundingBroadcastError: null
clears it); a field not given keeps its value.
Implementation
@override
ChannelState copyWith({
int? version,
DateTime? lastModified,
Object? walletId = _unset,
ChannelStatus? status,
Object? role = _unset,
Object? clientPeerId = _unset,
Object? serverPeerId = _unset,
Object? clientPubKeyHex = _unset,
Object? serverPubKeyHex = _unset,
Object? clientAddressB58 = _unset,
Object? serverAddressB58 = _unset,
Object? derivationIndex = _unset,
BigInt? fundingAmountSats,
Object? fundingTxId = _unset,
Object? fundingTxHex = _unset,
Object? fundingOutputIndex = _unset,
List<String>? fundingAncestorTxids,
Object? fundingBeefHex = _unset,
Object? fundingInputSats = _unset,
int? fundingBroadcastAttempts,
bool? fundingBroadcastInFlight,
Object? fundingBroadcastError = _unset,
bool? fundingRecordedInWallet,
bool? fundingSent,
bool? fundingFailed,
Object? lockTimeUnix = _unset,
Object? refundTxHex = _unset,
Object? refundClientSigHex = _unset,
Object? refundServerSigHex = _unset,
Object? signedRefundTxHex = _unset,
BigInt? clientBalanceSats,
BigInt? serverBalanceSats,
int? latestSequenceNumber,
Object? latestPaymentTxHex = _unset,
Object? latestPaymentTxId = _unset,
Object? latestClientSignatureHex = _unset,
bool? returnLegRecordedInWallet,
Object? context = _unset,
Object? counterpartyMarker = _unset,
Object? createdAt = _unset,
Object? refundClaimedTxId = _unset,
Object? closedAt = _unset,
}) {
T? pick<T>(Object? given, T? current) => identical(given, _unset) ? current : given as T?;
return ChannelState(
channelId: channelId,
walletId: pick<String>(walletId, this.walletId),
status: status ?? this.status,
role: pick<ChannelRole>(role, this.role),
clientPeerId: pick<String>(clientPeerId, this.clientPeerId),
serverPeerId: pick<String>(serverPeerId, this.serverPeerId),
clientPubKeyHex: pick<String>(clientPubKeyHex, this.clientPubKeyHex),
serverPubKeyHex: pick<String>(serverPubKeyHex, this.serverPubKeyHex),
clientAddressB58: pick<String>(clientAddressB58, this.clientAddressB58),
serverAddressB58: pick<String>(serverAddressB58, this.serverAddressB58),
derivationIndex: pick<int>(derivationIndex, this.derivationIndex),
fundingAmountSats: fundingAmountSats ?? this.fundingAmountSats,
fundingTxId: pick<String>(fundingTxId, this.fundingTxId),
fundingTxHex: pick<String>(fundingTxHex, this.fundingTxHex),
fundingOutputIndex: pick<int>(fundingOutputIndex, this.fundingOutputIndex),
fundingAncestorTxids: fundingAncestorTxids ?? this.fundingAncestorTxids,
fundingBeefHex: pick<String>(fundingBeefHex, this.fundingBeefHex),
fundingInputSats: pick<int>(fundingInputSats, this.fundingInputSats),
fundingBroadcastAttempts: fundingBroadcastAttempts ?? this.fundingBroadcastAttempts,
fundingBroadcastInFlight: fundingBroadcastInFlight ?? this.fundingBroadcastInFlight,
fundingBroadcastError: pick<String>(fundingBroadcastError, this.fundingBroadcastError),
fundingRecordedInWallet: fundingRecordedInWallet ?? this.fundingRecordedInWallet,
fundingSent: fundingSent ?? this.fundingSent,
fundingFailed: fundingFailed ?? this.fundingFailed,
lockTimeUnix: pick<int>(lockTimeUnix, this.lockTimeUnix),
refundTxHex: pick<String>(refundTxHex, this.refundTxHex),
refundClientSigHex: pick<String>(refundClientSigHex, this.refundClientSigHex),
refundServerSigHex: pick<String>(refundServerSigHex, this.refundServerSigHex),
signedRefundTxHex: pick<String>(signedRefundTxHex, this.signedRefundTxHex),
clientBalanceSats: clientBalanceSats ?? this.clientBalanceSats,
serverBalanceSats: serverBalanceSats ?? this.serverBalanceSats,
latestSequenceNumber: latestSequenceNumber ?? this.latestSequenceNumber,
latestPaymentTxHex: pick<String>(latestPaymentTxHex, this.latestPaymentTxHex),
latestPaymentTxId: pick<String>(latestPaymentTxId, this.latestPaymentTxId),
latestClientSignatureHex: pick<String>(latestClientSignatureHex, this.latestClientSignatureHex),
returnLegRecordedInWallet:
returnLegRecordedInWallet ?? this.returnLegRecordedInWallet,
context: pick<String>(context, this.context),
counterpartyMarker:
pick<String>(counterpartyMarker, this.counterpartyMarker),
createdAt: pick<DateTime>(createdAt, this.createdAt),
refundClaimedTxId:
pick<String>(refundClaimedTxId, this.refundClaimedTxId),
closedAt: pick<DateTime>(closedAt, this.closedAt),
version: version ?? this.version,
lastModified: lastModified ?? this.lastModified,
);
}