body: FutureBuilder(
future: taskList,
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
final int completedTaskCount = snapshot.data
.where((Task task) => task.status == 1)
.toList()
.length;
return ListView.builder(
padding: EdgeInsets.symmetric(vertical: 50.0),
itemCount: 1 + snapshot.data.length,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 40.0, vertical: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'My Tasks',
style: TextStyle(
color: Colors.black,
fontSize: 40,
fontWeight: FontWeight.bold),
),
SizedBox(
height: 10,
),
Text(
'$completedTaskCount of ${snapshot.data.length}',
style: TextStyle(
color: Colors.grey,
fontSize: 20,
fontWeight: FontWeight.w600),
),
],
),
);
}
return _buildTask(snapshot.data(index - 1));
});
},
),
this is the error I got:
Class 'List<Task>' has no instance method 'call'.
Receiver: Instance(length:2) of '_GrowableList'
Tried calling: call(0)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…