BMFSuggestAddrInfo.fromMap constructor

BMFSuggestAddrInfo.fromMap(
  1. Map map
)

map => BMFSuggestAddrInfo

Implementation

BMFSuggestAddrInfo.fromMap(Map map)
    : assert(map != null,
          'Construct a BMFSuggestAddrInfo,The parameter map cannot be null !') {
  if (map['startPoiList'] != null) {
    startPoiList = new List<BMFPoiInfo>();
    map['startPoiList'].forEach((v) {
      startPoiList.add(BMFPoiInfo.fromMap(v as Map));
    });
  }
  if (map['startCityList'] != null) {
    startCityList = new List<BMFCityListInfo>();
    map['startCityList'].forEach((v) {
      startCityList.add(BMFCityListInfo.fromMap(v as Map));
    });
  }
  if (map['endPoiList'] != null) {
    endPoiList = new List<BMFPoiInfo>();
    map['endPoiList'].forEach((v) {
      endPoiList.add(BMFPoiInfo.fromMap(v as Map));
    });
  }
  if (map['endCityList'] != null) {
    endCityList = new List<BMFCityListInfo>();
    map['endCityList'].forEach((v) {
      endCityList.add(BMFCityListInfo.fromMap(v as Map));
    });
  }
  if (map['wayPointPoiList'] != null) {
    wayPointPoiList = new List<List<BMFPoiInfo>>();
    for (List item in map['wayPointPoiList'] as List) {
      List<BMFPoiInfo> list = new List();
      for (var ite in item) {
        BMFPoiInfo info = BMFPoiInfo.fromMap(ite as Map);
        list.add(info);
      }
      wayPointPoiList.add(list);
    }
  }

  if (map['wayPointCityList'] != null) {
    wayPointCityList = new List<List<BMFCityListInfo>>();
    for (List item in map['wayPointCityList'] as List) {
      List<BMFCityListInfo> list = new List();
      for (var ite in item) {
        BMFCityListInfo cityListInfo = BMFCityListInfo.fromMap(ite as Map);
        list.add(cityListInfo);
      }
      wayPointCityList.add(list);
    }
  }
}