dashArray property
Apply same dash pattern for all the MapPolyline in the polylines collection.
A sequence of dash and gap will be rendered based on the values in this list. Once all values of the list is rendered, it will be repeated again till the end of the polyline.
late List<MapLatLng> _polylines;
late MapShapeSource _mapSource;
@override
void initState() {
_polylines = <MapLatLng>[
MapLatLng(13.0827, 80.2707),
MapLatLng(14.4673, 78.8242),
MapLatLng(14.9091, 78.0092),
MapLatLng(16.2160, 77.3566),
MapLatLng(17.1557, 76.8697),
MapLatLng(18.0975, 75.4249),
MapLatLng(18.5204, 73.8567),
MapLatLng(19.0760, 72.8777),
];
_mapSource = MapShapeSource.asset(
'assets/india.json',
shapeDataField: 'name',
);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SfMaps(
layers: [
MapShapeLayer(
source: _mapSource,
sublayers: [
MapPolylineLayer(
dashArray: [8, 3, 4, 3],
polylines: List<MapPolyline>.generate(
1,
(int index) {
return MapPolyline(
points: _polylines,
);
},
).toSet(),
),
],
),
],
),
);
}
See also:
- The MapPolyline.dashArray, to apply dash pattern for the individual map polyline.
Implementation
final List<double> dashArray;