This repository was archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathtasks_data_source.dart
More file actions
49 lines (37 loc) · 1.56 KB
/
tasks_data_source.dart
File metadata and controls
49 lines (37 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import 'package:flutter/cupertino.dart';
import 'package:flutter_template/model/task/task.dart';
import 'package:flutter_template/model/task/task_group.dart';
/// Main entry point for accessing and manipulating tasks data.
abstract class TasksDataSource {
abstract final String userId;
/// Get all task groups for the logged in user.
Future<List<TaskGroup>> getTaskGroups();
/// Get all tasks belonging to a task group.
///
/// Throws [DataNotFoundException] unless ALL tasks are retrieved.
Future<List<Task>> getTasks(String taskGroupId);
/// Find a task by id.
///
/// Throws [DataNotFoundException] if the tasks could not be found.
Future<Task> getTask(String taskId);
/// Mark a [Task] as done.
///
/// Throws [DataNotFoundException] if the tasks could not be found.
Future<void> completeTask(String taskId);
/// Mark a [Task] as not done.
///
/// Throws [DataNotFoundException] if the tasks could not be found.
Future<void> reopenTask(String taskId);
/// Gets all tasks grouped by TaskGroup.
Future<Map<TaskGroup, List<Task>>> getAllTasksGrouped();
/// Creates a new [Task]. [Task.id] is overwritten by server.
Future<Task> createTask(Task createTask);
/// Creates a new [TaskGroup]. [TaskGroup.id] is overwritten by server.
Future<TaskGroup> createTaskGroup(TaskGroup createTaskGroup);
/// Updates taskIds in given task group.
Future<TaskGroup> updateTaskGroup(final TaskGroup taskGroup);
/// Deletes all task groups.
Future<void> deleteAllTaskGroups();
/// Deletes all user data.
Future<void> deleteAllData();
}