I need to Iterate through a list of objects inside an array in flutter, tried the map function, But its showing some errors,
final List<dynamic> data = [
{
'ccNumber': '1111 1111 1111 1111',
'expDate': '12/27',
'cvv': '123',
'ccHolderName': 'xxx'
},
{
'ccNumber': '2222 2222 2222 2222',
'expDate': '12/27',
'cvv': '123',
'ccHolderName': 'yyy'
},
{
'ccNumber': '3333 3333 3333 3333',
'expDate': '12/27',
'cvv': '123',
'ccHolderName': 'zzz'
}
];
This is the object of array si want to iterate and i want to iterate below widget.
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('1212 21** ****'),
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: const SingleChildScrollView(
scrollDirection: Axis.vertical,
child: CardsWidget(),
),
);
},
);
},
icon: const FaIcon(
FontAwesomeIcons.pen,
size: 16,
),
),
],
),
Need to iterate through the Row and want the ccNumber in object array to show at const Text section and pass each data to the CardsWidget(). tried many ways, but nothing seems to work.