copyWith method

  1. @override
ChannelState copyWith({
  1. int? version,
  2. DateTime? lastModified,
  3. Object? walletId = _unset,
  4. ChannelStatus? status,
  5. Object? role = _unset,
  6. Object? clientPeerId = _unset,
  7. Object? serverPeerId = _unset,
  8. Object? clientPubKeyHex = _unset,
  9. Object? serverPubKeyHex = _unset,
  10. Object? clientAddressB58 = _unset,
  11. Object? serverAddressB58 = _unset,
  12. Object? derivationIndex = _unset,
  13. BigInt? fundingAmountSats,
  14. Object? fundingTxId = _unset,
  15. Object? fundingTxHex = _unset,
  16. Object? fundingOutputIndex = _unset,
  17. List<String>? fundingAncestorTxids,
  18. Object? fundingBeefHex = _unset,
  19. Object? fundingInputSats = _unset,
  20. int? fundingBroadcastAttempts,
  21. bool? fundingBroadcastInFlight,
  22. Object? fundingBroadcastError = _unset,
  23. bool? fundingRecordedInWallet,
  24. Object? lockTimeUnix = _unset,
  25. Object? refundTxHex = _unset,
  26. Object? refundClientSigHex = _unset,
  27. Object? refundServerSigHex = _unset,
  28. Object? signedRefundTxHex = _unset,
  29. BigInt? clientBalanceSats,
  30. BigInt? serverBalanceSats,
  31. int? latestSequenceNumber,
  32. Object? latestPaymentTxHex = _unset,
  33. Object? latestPaymentTxId = _unset,
  34. bool? returnLegRecordedInWallet,
  35. Object? context = _unset,
  36. Object? counterpartyMarker = _unset,
  37. Object? createdAt = _unset,
  38. Object? refundClaimedTxId = _unset,
  39. 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,
  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,
  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,
    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),
    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,
  );
}