Files
Auto-GPT/lib/viewmodels/mock_data.dart
hunteraraujo 5b520eb5ae Implement TaskViewModel with tests and mock data
This commit introduces the TaskViewModel, which manages the business logic for tasks. The ViewModel interacts with a mock data source, providing functionalities like fetching tasks, selecting a task, creating, and deleting tasks.

Additionally, comprehensive tests for TaskViewModel have been added to ensure its behavior aligns with expectations. The mock data source has also been updated to support the new functionalities.

Key Features:
- Task management in TaskViewModel.
- Tests for each major functionality in TaskViewModel.
- Mock data source to simulate data interactions.
2023-08-21 00:03:39 +02:00

21 lines
546 B
Dart

import 'package:auto_gpt_flutter_client/models/task.dart';
/// A list of mock tasks for the application.
/// TODO: Remove this file when we implement TaskService
List<Task> mockTasks = [
Task(id: 1, title: 'Task 1'),
Task(id: 2, title: 'Task 2'),
Task(id: 3, title: 'Task 3'),
// ... add more mock tasks as needed
];
/// Adds a task to the mock data.
void addTask(Task task) {
mockTasks.add(task);
}
/// Removes a task from the mock data based on its ID.
void removeTask(int id) {
mockTasks.removeWhere((task) => task.id == id);
}