Future<int> getCountTodo(int taskId) async {
Database db = await this.db;
List<Map<String, dynamic>> x = await db.rawQuery('SELECT COUNT (*) from $todoTable where taskId=$taskId');
// List<Map<String, dynamic>> x = await db.rawQuery('SELECT COUNT(*),t.title FROM todo_table td, task_table t WHERE t.id=td.taskId GROUP BY taskId');
int result = Sqflite.firstIntValue(x);
print('Todo inside task: $result');
return result;
}
Text (
// '${1}'+" ITEM",
DatabaseHelper.instance.getCountTodo(task.tasklist[index].id).toString(),
style: TextStyle(
fontSize: 14.0,
color: Colors.grey,
fontWeight: FontWeight.bold),
)
如何在文本小部件中获取计数结果。我得到了“未来”的实例。