copyWith method

Task copyWith({
  1. String? title,
  2. String? subtitle,
})

Creates a copy of this task with optionally updated fields.

The id is preserved while title and subtitle can be updated.

Implementation

Task copyWith({ String? title, String? subtitle}) {
  return Task(
    id: id,
    title: title ?? this.title,
    subtitle: subtitle ?? this.subtitle,
  );
}