fix todo
This commit is contained in:
44
lib/features/todos/domain/entities/todo.dart
Normal file
44
lib/features/todos/domain/entities/todo.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class Todo extends Equatable {
|
||||
final int id;
|
||||
final String title;
|
||||
final String? description;
|
||||
final bool completed;
|
||||
final String userId;
|
||||
final DateTime? createdAt;
|
||||
final DateTime? updatedAt;
|
||||
|
||||
const Todo({
|
||||
required this.id,
|
||||
required this.title,
|
||||
this.description,
|
||||
required this.completed,
|
||||
required this.userId,
|
||||
this.createdAt,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
Todo copyWith({
|
||||
int? id,
|
||||
String? title,
|
||||
String? description,
|
||||
bool? completed,
|
||||
String? userId,
|
||||
DateTime? createdAt,
|
||||
DateTime? updatedAt,
|
||||
}) {
|
||||
return Todo(
|
||||
id: id ?? this.id,
|
||||
title: title ?? this.title,
|
||||
description: description ?? this.description,
|
||||
completed: completed ?? this.completed,
|
||||
userId: userId ?? this.userId,
|
||||
createdAt: createdAt ?? this.createdAt,
|
||||
updatedAt: updatedAt ?? this.updatedAt,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, title, description, completed, userId, createdAt, updatedAt];
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import '../../../../core/errors/failures.dart';
|
||||
import '../entities/todo.dart';
|
||||
|
||||
abstract class TodoRepository {
|
||||
Future<Either<Failure, List<Todo>>> getTodos();
|
||||
Future<Either<Failure, void>> refreshTodos();
|
||||
}
|
||||
Reference in New Issue
Block a user