Instance of ‘Future’

Solution for Instance of ‘Future
is Given Below:

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 GROUP BY taskId');
   int result = Sqflite.firstIntValue(x);
   print('Todo inside task: $result');
   return result;

Text (
 // '${1}'+" ITEM", 
 style: TextStyle(
   fontSize: 14.0,
   color: Colors.grey,
   fontWeight: FontWeight.bold),

How can i get the count result here in text widget. I’m getting Instance of ‘Future’.

It’s better practice to use a future builder here:

 future: DatabaseHelper.instance.getCountTodo(task.tasklist[index].id),
 builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
       switch (snapshot.connectionState) {
         case ConnectionState.waiting: return Text('Loading....');
           if (snapshot.hasError)
              return Text('Error: ${snapshot.error}');
           else if (
              return Text('Loading....');
          return Text('${}');