copyWith method

ChartPosition copyWith({
  1. String? id,
  2. String? symbol,
  3. PositionSide? side,
  4. double? entryPrice,
  5. double? quantity,
  6. ValueGetter<double?>? takeProfitPrice,
  7. ValueGetter<double?>? stopLossPrice,
  8. DateTime? openedAt,
  9. String? customLabel,
  10. Map<String, dynamic>? metadata,
})

Implementation

ChartPosition copyWith({
  String? id,
  String? symbol,
  PositionSide? side,
  double? entryPrice,
  double? quantity,
  ValueGetter<double?>? takeProfitPrice,
  ValueGetter<double?>? stopLossPrice,
  DateTime? openedAt,
  String? customLabel,
  Map<String, dynamic>? metadata,
}) {
  return ChartPosition(
    id: id ?? this.id,
    symbol: symbol ?? this.symbol,
    side: side ?? this.side,
    entryPrice: entryPrice ?? this.entryPrice,
    quantity: quantity ?? this.quantity,
    takeProfitPrice:
        takeProfitPrice != null ? takeProfitPrice() : this.takeProfitPrice,
    stopLossPrice:
        stopLossPrice != null ? stopLossPrice() : this.stopLossPrice,
    openedAt: openedAt ?? this.openedAt,
    customLabel: customLabel ?? this.customLabel,
    metadata: metadata ?? this.metadata,
  );
}