'How to join two key values from map in dart?

I have this List<Map>:

var listMap = [
        {
          "label": "Title",
          "align": "left",
          "width": 50
        },
        {
          "label": "Date Created",
          "align": "left",
          "width": 50
        },

];

I want to join label, align and width with | So the final result is of type List<String> :

var finalResult = ["Title|left|50", "Date Created|left|50"];

How can i achieve finalResult?



Solution 1:[1]

I have tried this

var listMap = [
        {
          "label": "Title",
          "align": "left",
          "width": 50
        },
        {
          "label": "Date Created",
          "align": "left",
          "width": 50
        },

];
  var newList = [];
  for (var e in listMap) {
    newList.add(e.values.join('|'));
  }
  print(newList);

Also @pskink answer is correct to!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MerdanDev