I have been trying to convert my app to new flutter new version but I got this error The argument type Object?
can't be assigned to the parameter type List
that can't be fix.... can somebody help me fix this problem
list() {
return Expanded(
child: FutureBuilder(
future: employees,
builder: (context, snapshot) {
if (snapshot.hasData) {
return dataTable(List<Url>.from(snapshot.data));
}
if (null == snapshot.data || snapshot.data == 0) {
return Text("Tiada Data");
}
return CircularProgressIndicator();
},
),
);
}
It is because you need to cast the type of your FutureBuilder
. Based on your code I deduce that employees
is of type Future<List>
or at least Future<Iterable>
then you should define the type of your builder like this:
FutureBuilder<Iterable>(
future: employees,
builder: (context, snapshot) {
if (snapshot.hasData) {
return dataTable(List<Url>.from(snapshot.data!));
}
// ...
},
),