file<T extends Object> static method
Loads and displays polygons from a file on a map.
The path parameter specifies the file path to the polygon data file.
Example:
PowerGeoJSONPolygons.file(
'path/to/polygon_data.geojson',
polygonProperties: PolygonProperties(
strokeColor: Colors.green,
),
)
Implementation
static Widget file<T extends Object>(
String path, {
// layer
Key? key,
bool polygonCulling = false,
PolygonProperties<T>? polygonProperties,
Future<String> Function(String)? fileLoadBuilder,
Polygon<T> Function(
List<List<LatLng>> coordinates,
Map<String, dynamic>? map,
)?
builder,
MapController? mapController,
Widget Function()? fallback,
}) {
assert(
(builder == null && polygonProperties != null) ||
(polygonProperties == null && builder != null),
);
if (AppPlatform.isWeb) {
throw UnsupportedError('Unsupported platform: Web');
}
return EnhancedFutureBuilder<Widget>(
future: _filePolygons(
fileLoadBuilder: fileLoadBuilder ?? defaultFileLoadBuilder,
path,
builder: builder,
polygonProperties: polygonProperties,
key: key,
fallback: fallback,
polygonCulling: polygonCulling,
mapController: mapController,
),
rememberFutureResult: true,
whenDone: (Widget snapshotData) => snapshotData,
whenNotDone: const Center(child: CupertinoActivityIndicator()),
);
}