the element type 'List' can't be assigned to the list type 'Widget'

前端 未结 4 1148
死守一世寂寞
死守一世寂寞 2021-02-05 03:19

I am trying to add data using for loop in gridview but it is showing some error. Here is my code for component

return new GridView.count(
    crossAxisCount: 2,
         


        
4条回答
  •  日久生厌
    2021-02-05 03:57

    Just use spread operator:

    return new GridView.count(
        crossAxisCount: 2,
        padding: const EdgeInsets.all(10.0),
        crossAxisSpacing: 10.0,
        mainAxisSpacing: 10.0,
        children: [...getList()],
    );
    

提交回复
热议问题