copyWith method

PlannerEntry<T> copyWith({
  1. String? id,
  2. PlannerTime? time,
  3. Color? color,
  4. TextStyle? titleStyle,
  5. TextStyle? textStyle,
  6. String? title,
  7. String? content,
  8. T? data,
})

Returns a copy with the given fields replaced; omitted fields are kept.

data follows the same data ?? this.data rule as every other field, so in this first cut (#77) it can be set or changed but not reset to null; a sentinel can be added later if clearing the payload is needed.

Implementation

PlannerEntry<T> copyWith({
  String? id,
  PlannerTime? time,
  Color? color,
  TextStyle? titleStyle,
  TextStyle? textStyle,
  String? title,
  String? content,
  T? data,
}) =>
    PlannerEntry<T>(
      id: id ?? this.id,
      time: time ?? this.time,
      color: color ?? this.color,
      titleStyle: titleStyle ?? this.titleStyle,
      textStyle: textStyle ?? this.textStyle,
      title: title ?? this.title,
      content: content ?? this.content,
      data: data ?? this.data,
    );