Skip to content

Instantly share code, notes, and snippets.

@brasizza
Created October 4, 2021 17:58
Show Gist options
  • Select an option

  • Save brasizza/c928131469b490604374081842e9cfe9 to your computer and use it in GitHub Desktop.

Select an option

Save brasizza/c928131469b490604374081842e9cfe9 to your computer and use it in GitHub Desktop.
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