Created
October 4, 2021 17:58
-
-
Save brasizza/c928131469b490604374081842e9cfe9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:get/get.dart'; | |
| import 'package:hive_tutorial/app/data/models/todo_model.dart'; | |
| import 'package:hive_tutorial/app/modules/home/controllers/home_controller.dart'; | |
| class DialogController extends GetxController { | |
| final todoCheck = false.obs; | |
| void addTask({required String title, String? description, String? tag}) { | |
| final hc = Get.find<HomeController>(); | |
| int id = DateTime.now().millisecond; | |
| final _task = TodoModel( | |
| id: id, | |
| title: title, | |
| descritpion: description ?? '', | |
| tag: tag ?? '', | |
| done: todoCheck.value, | |
| ); | |
| hc.todoList.add(_task); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment