getData static method

List<WeatherMsgData> getData(
  1. Map data
)

Implementation

static List<WeatherMsgData> getData(Map data) {
  List<WeatherMsgData> dataList = [];
  List<String> dates = data["date"].split(",");
  List<String> codes = data["weatherCode"].split(",");
  List<String> maxs = data["max"].split(",");
  List<String> mins = data["min"].split(",");
  for (int i = 0; i < dates.length; i++) {
    dataList.add(WeatherMsgData(
      date: dates[i],
      code: codes[i],
      max: double.parse(maxs[i]),
      min: double.parse(mins[i]),
    ));
  }
  return dataList;
}