如何根据项目索引增加列表变量?

im getting an error: type int is not a subtype of type List<dynamic> of function result on pressing add

final itemcount = [];

Widget buildItem(BuildContext context, DocumentSnapshot document, int index) {
  return Container(
    child: Flatbutton(
      child:Text("add"),
      onpressed:(){
        itemcount[index]=itemcount[index]+1,
      }
    )
  );
}
评论