implemented way to add todo

This commit is contained in:
SomnusVeritas
2023-11-08 11:34:39 +01:00
parent d2f3eb109d
commit 15c404c962
5 changed files with 50 additions and 8 deletions

View File

@@ -13,10 +13,9 @@ class DbHelper {
schemas: [TodoSchema],
directory: dir.path,
);
var todos = [
Todo(id: nextTodoId, title: 'Get Stuff Done'),
Todo(id: nextTodoId, title: 'Some shit'),
];
_isar.write((isar) => isar.todos.putAll(todos));
}
static List<Todo> fetchTodos() => _isar.todos.where().findAll();
static void addTodo(Todo todo) => _isar.write((isar) => isar.todos.put(todo));
}