copyWith method

ChartDataPoint copyWith({
  1. double? x,
  2. double? y,
  3. String? label,
  4. bool? showValue,
})

Creates a copy of this data point with the given fields replaced.

Returns a new ChartDataPoint with the same values as this one, except for the fields that are explicitly provided.

Implementation

ChartDataPoint copyWith({
  double? x,
  double? y,
  String? label,
  bool? showValue,
}) {
  return ChartDataPoint(
    x: x ?? this.x,
    y: y ?? this.y,
    label: label ?? this.label,
    showValue: showValue ?? this.showValue,
  );
}