Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.forEach that accepts multiple lines in Flutter

Tags:

flutter

dart

I am trying to loop through an array in flutter called, cart and I need to execute multiple lines, I couldn't figure out how to do it

`Map<int, dynamic> cart = {77 => "ABC", 110 => "XYZ"};
cart.forEach((K,V) => {
    print(K);
    print(V);
});`

Why this wouldn't work? I think I am missing a function somewhere

like image 423
Ahmed Albarody Avatar asked Oct 21 '25 03:10

Ahmed Albarody


1 Answers

Map<int, dynamic> cart = {77 : "ABC", 110 : "XYZ"};
cart.forEach((k, v) {

  print("$k: $v");

}); 
like image 53
Arun R. Prajapati Avatar answered Oct 25 '25 09:10

Arun R. Prajapati



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!