asset<T extends Object> static method
- String url, {
- PolylineProperties<
T> ? polylineProperties, - Polyline<
T> builder()?, - MapController? mapController,
- Key? key,
Loads and displays polylines from an asset file on a map.
The PowerGeoJSONPolylines.asset method loads polyline data from an asset file specified by
the url parameter and displays it on a map. You can customize the rendering
of the polylines using polylineProperties and builder.
Example usage:
PowerGeoJSONPolylines.asset(
'assets/polyline_data.json',
polylineProperties: PolylineProperties(
color: Colors.blue,
width: 3.0,
),
mapController: myMapController,
);
The polylineCulling parameter allows you to enable or disable culling of
polylines that are outside the map's viewport, improving performance.
Returns a widget displaying the loaded polylines on the map.
Implementation
static Widget asset<T extends Object>(
String url, {
PolylineProperties<T>? polylineProperties,
Polyline<T> Function(List<LatLng> points, Map<String, Object?>? map)?
builder,
MapController? mapController,
Key? key,
}) {
return EnhancedFutureBuilder<Widget>(
future: _assetPolylines(
url,
polylineProperties: polylineProperties ?? PolylineProperties<T>(),
builder: builder,
mapController: mapController,
key: key,
),
rememberFutureResult: true,
whenDone: (Widget snapshotData) => snapshotData,
whenNotDone: const Center(child: CupertinoActivityIndicator()),
);
}