Answers for "dart map through an object of object"

1

dart loop through map

main() {
  var numMap = Map();
  numMap["one"] = 1;
  numMap["two"] = 2;
  numMap["three"] = 3;
  numMap["four"] = 4;
  numMap["five"] = 5;

  numMap.forEach((k, v) => print("Key : $k, Value : $v"));
}
Posted by: Guest on March-05-2021
0

dart object to map

class Human {
  String name;
  int age;

  Map<String, dynamic> toMap() {
    return {
      'name': name,
      'age': age,
    };
  }
}
Posted by: Guest on December-28-2020

Code answers related to "dart map through an object of object"

Code answers related to "Dart"

Browse Popular Code Answers by Language