Task constructor

Task({
  1. required String id,
  2. required String title,
  3. required String subtitle,
})

Creates a new task with the given id, title, and subtitle.

Throws TaskOperationException if:

  • title is longer than 100 characters
  • subtitle is longer than 100 characters

Implementation

Task({required this.id, required this.title, required this.subtitle}) {
  if (title.length > 100) {
    throw TaskOperationException('Title must be at most 100 characters long.');
  }
  if (subtitle.length > 100) {
    throw TaskOperationException('Subtitle must be at most 100 characters long.');
  }
}