Skip to content

Commit a8b54c7

Browse files
evil159maios
andauthored
Add missing constructors to turf-derived types (#596)
* Add missing factory methods to turf-derived types * Apply suggestions from code review Co-authored-by: Mai Mai <mai.mai@mapbox.com> --------- Co-authored-by: Mai Mai <mai.mai@mapbox.com>
1 parent 4356098 commit a8b54c7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/src/turf_adapters.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ final class Polygon extends turf.Polygon {
3434
final polygon = turf.Polygon.fromJson(json);
3535
return Polygon(bbox: polygon.bbox, coordinates: polygon.coordinates);
3636
}
37+
38+
Polygon.fromPoints({turf.BBox? bbox, required List<List<Point>> points}) : super.fromPoints(bbox: bbox, points: points);
3739
}
3840

3941
final class LineString extends turf.LineString {
@@ -52,4 +54,6 @@ final class LineString extends turf.LineString {
5254
final line = turf.LineString.fromJson(json);
5355
return LineString(bbox: line.bbox, coordinates: line.coordinates);
5456
}
57+
58+
LineString.fromPoints({turf.BBox? bbox, required List<Point> points}) : super.fromPoints(bbox: bbox, points: points);
5559
}

0 commit comments

Comments
 (0)