List<TableColumn> parseColumns(List list)

parse List of Map into TableColumn

Source

static List<TableColumn> parseColumns(List list) {
  List<TableColumn> rslt = <TableColumn>[];
  for (Object m in list) {
    if (m is Map && m["name"] is String) {
      String type = "string";
      if (m["type"] is String) {
        type = m["type"];
      }
      rslt.add(new TableColumn(m["name"], type, m["default"]));
    } else if (m is TableColumn) {
      rslt.add(m);
    } else {
      // invalid column data
      return null;
    }
  }
  return rslt;
}