BMFDistrictSearchResult.fromMap constructor Null safety

BMFDistrictSearchResult.fromMap(
  1. Map map
)

map => BMFDistrictSearchResult

Implementation

BMFDistrictSearchResult.fromMap(Map map)
    : assert(
          map != null, // ignore: unnecessary_null_comparison
          'Construct a BMFDistrictSearchResult,The parameter map cannot be null !') {
  code = map['code'];
  name = map['name'];
  center =
      map['center'] == null ? null : BMFCoordinate.fromMap(map['center']);

  if (map['paths'] != null) {
    List<List<BMFCoordinate>> tmpPaths = [];
    for (List item in (map['paths'] as List)) {
      List<BMFCoordinate> list = [];
      for (var ite in item) {
        BMFCoordinate coordinate = BMFCoordinate.fromMap(ite as Map);
        list.add(coordinate);
      }
      tmpPaths.add(list);
    }
    paths = tmpPaths;
  }
}