what i am trying to is have containers widget to have unique id so that i can uniquely identify them i have tried :
Map<int,Container> box={
1:Container(),
2:Container(),
3:Container(),
};
Map<int,Widget> box={
1:Container(),
2:Container(),
3:Container(),
};
Column(
mainAxisAlignment: MainAxisAlignment.start,
children:<Widget> [
box[1],
],
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
children:[
box[1],
],
),
tried both
is there any way to do this .
CodePudding user response:
I believe you are trying to use List<Widget>
Define:
List<Widget> list = [Container(), Container(), Container()];
Use:
Column(
children: [list[0]],
);