Task manager

Isar - local storage

// Some code
class TaskModel {
  final int id;
  final String title;
  final String description;
  final DateTime dueDate;
  final bool isCompleted;
  final int priority;
  final String categoryId;
  final DateTime createdAt;

  TaskModel({
    required this.id,
    required this.title,
    this.description = '',
    required this.dueDate,
    this.isCompleted = false,
    this.priority = 0,
    required this.categoryId,
    required this.createdAt,
  });


  TaskModel copyWith({
    String? title,
    String? description,
    bool? isCompleted,
    int? priority,
    DateTime? dueDate,
  }) {
    return TaskModel(
        id: this.id,
        title: title ?? this.title,
        description: description ?? this.description,
        dueDate: dueDate ?? this.dueDate,
        priority: priority ?? this.priority,
        isCompleted: isCompleted ?? this.isCompleted,
        categoryId: this.categoryId,
        createdAt: this.createdAt);
  }
}

Last updated