network<T extends Object> static method

Widget network<T extends Object>(
  1. String url, {
  2. Client? client,
  3. Map<String, String>? headers,
  4. required Widget builder(
    1. FeatureCollectionProperties<T> featureCollectionProperties,
    2. Map<String, dynamic>? map
    ),
  5. required FeatureCollectionProperties<T> featureCollectionProperties,
  6. bool polygonCulling = false,
  7. MapController? mapController,
  8. Future<String> networkLoadBuilder(
    1. Client? client,
    2. Uri uri,
    3. Map<String, String>? map
    )?,
  9. Key? key,
  10. PowerMarkerClusterOptions? powerClusterOptions,
})

Fetches GeoJSON feature collections from a network source and returns a Widget to display them.

  • url: The URL of the network resource containing the GeoJSON data.
  • client: An optional HTTP client to use for the network request.
  • headers: Optional HTTP headers to include in the request.
  • builder: A function that takes the featureCollectionProperties and a map of feature properties and returns a Widget to render the features.
  • featureCollectionProperties: Properties to customize the appearance of the feature collections.
  • polylineCulling: A boolean indicating whether polyline culling is enabled (default is false).
  • polygonCulling: A boolean indicating whether polygon culling is enabled (default is false).
  • mapController: An optional MapController for controlling the map view.
  • networkLoadBuilder: A function that loads data from the network resource and returns it as a string.
  • key: An optional Key for identifying the returned Widget.

Returns a Widget displaying the fetched GeoJSON feature collections.

Implementation

static Widget network<T extends Object>(
  String url, {
  Client? client,
  Map<String, String>? headers,
  required Widget Function(
    FeatureCollectionProperties<T> featureCollectionProperties,
    Map<String, dynamic>? map,
  )
  builder,
  required FeatureCollectionProperties<T> featureCollectionProperties,
  bool polygonCulling = false,
  MapController? mapController,
  Future<String> Function(Client? client, Uri uri, Map<String, String>? map)?
  networkLoadBuilder,
  Key? key,
  PowerMarkerClusterOptions? powerClusterOptions,
}) {
  Uri uri = url.toUri();
  return EnhancedFutureBuilder<Widget>(
    future: _networkFeatureCollections(
      uri,
      powerClusterOptions: powerClusterOptions,
      headers: headers,
      client: client,
      featureCollectionProperties: featureCollectionProperties,
      networkLoadBuilder: networkLoadBuilder ?? _defaultNetworkLoader,
      builder: builder,
      polygonCulling: polygonCulling,
      mapController: mapController,
      key: key,
    ),
    rememberFutureResult: true,
    whenDone: (Widget child) => child,
    whenNotDone: const Center(child: CupertinoActivityIndicator()),
  );
}