network<T extends Object> static method
Loads and displays polygons from a network source on a map.
The url parameter specifies the URL of the polygon data source.
Example:
PowerGeoJSONPolygons.network(
'https://example.com/polygon_data.geojson',
builder: (coordinates, properties) {
// Customize polygon rendering
return Polygon(
points: coordinates[0].map((point) => LatLng(point[1], point[0])).toList(),
// Add more polygon properties as needed
);
},
mapController: myMapController,
)
Implementation
static Widget network<T extends Object>(
String url, {
Client? client,
List<int> statusCodes = const <int>[200],
Map<String, String>? headers,
// layer
Key? key,
bool polygonCulling = false,
Polygon<T> Function(
List<List<LatLng>> coordinates,
Map<String, dynamic>? map,
)?
builder,
PolygonProperties<T>? polygonProperties,
MapController? mapController,
Widget Function(int? statusCode)? fallback,
}) {
assert(
(builder == null && polygonProperties != null) ||
(polygonProperties == null && builder != null),
);
Uri uriString = url.toUri();
return EnhancedFutureBuilder<Widget>(
future: _networkPolygons(
uriString,
builder: builder,
headers: headers,
client: client,
statusCodes: statusCodes,
polygonProperties: polygonProperties,
key: key,
polygonCulling: polygonCulling,
mapController: mapController,
fallback: fallback,
),
rememberFutureResult: true,
whenDone: (Widget snapshotData) => snapshotData,
whenNotDone: const Center(child: CupertinoActivityIndicator()),
);
}