Reputation: 3
I got an error when I tried to display a list of type Future<List?> (variable rssItems). Error: The return type 'Iterable' isn't a 'Widget', as required by the closure's context.
[error is displayed]
FutureBuilder<List<RSSItem>?>(
future: rssItems,
builder: (context,snapshot)
{
return ListView.builder(
itemCount: snapshot.data!.length,
itemBuilder: (context, index){
return snapshot.data!.map((e) => Card()).toList();
}
);
},)
erorr: The return type 'List<Card'>' isn't a 'Widget', as required by the closure's context.
Upvotes: 0
Views: 373
Reputation: 1019
change return to
return snapshot.data!.map((e)=> Card(...args : e));
here ...args stands for the different parameters of Card()
widget
Upvotes: 1