You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How did you declare shoppingList? From the error you mention it seems shoppingList is declared as int, while getLists() returns a Future of type List. So shoppingList should be declared as "List": like
Here is my getList function:
Future<List> getLists() async {
final List<Map<String, dynamic>> maps = await db.query('lists');
// ignore: missing_return
return List.generate(maps.length, (i) {
return ShoppingList(
maps[i]['id'],
maps[i]['name'],
maps[i]['priority'],
);
});
}
I am calling it from here
showData() async {
dynamic bb;
await helper.openDb();
shoppingList = await helper.getLists();
setState(() {
shoppingList=shoppingList;
});
}
}
I am getting the error
type 'List' is not a subtype of type 'int'
The text was updated successfully, but these errors were encountered: