asset<T extends Object> static method

Widget asset<T extends Object>(
  1. String url, {
  2. PolylineProperties<T>? polylineProperties,
  3. Polyline<T> builder(
    1. List<LatLng> points,
    2. Map<String, Object?>? map
    )?,
  4. MapController? mapController,
  5. 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()),
  );
}