WebShapePoint.fromMapPoint constructor

WebShapePoint.fromMapPoint(
  1. dynamic payload
)

Implementation

factory WebShapePoint.fromMapPoint(dynamic payload) {
  final path = payload["points"].map<LatLng>(LatLng.fromMessageable).toList();
  final point = WebShapePoint(path);

  if (payload.containsKey("holes") && payload["holes"].length > 0) {
    payload["holes"]
        .map<List<LatLng>>(
            (e1) => e1.map<LatLng>((e2) => LatLng.fromMessageable).toList())
        .forEach(point.holes.add);
  }
  return point;
}