file<T extends Object> static method
- String path, {
- required FeatureCollectionProperties<
T> featureCollectionProperties, - bool polygonCulling = false,
- MapController? mapController,
- Key? key,
- Future<
String> fileLoadBuilder()?, - required Widget builder(
- FeatureCollectionProperties<
T> featureCollectionProperties, - Map<
String, dynamic> ? map
- FeatureCollectionProperties<
- PowerMarkerClusterOptions? powerClusterOptions,
Loads and displays GeoJSON feature collections from a local file as a Widget.
path: The path to the local file containing the GeoJSON data.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.fileLoadBuilder: A function that reads the file and returns its content as a string.builder: A function that takes thefeatureCollectionPropertiesand a map of feature properties and returns a Widget to render the features.key: An optional Key for identifying the returned Widget.
Returns a Widget displaying the GeoJSON feature collections from the local file.
Implementation
static Widget file<T extends Object>(
String path, {
required FeatureCollectionProperties<T> featureCollectionProperties,
bool polygonCulling = false,
MapController? mapController,
Key? key,
Future<String> Function(String)? fileLoadBuilder,
required Widget Function(
FeatureCollectionProperties<T> featureCollectionProperties,
Map<String, dynamic>? map,
)
builder,
PowerMarkerClusterOptions? powerClusterOptions,
}) {
if (AppPlatform.isWeb) {
throw UnsupportedError('Unsupported platform: Web');
}
return EnhancedFutureBuilder<Widget>(
future: _fileFeatureCollections(
path,
fileLoadBuilder: fileLoadBuilder ?? defaultFileLoadBuilder,
powerClusterOptions: powerClusterOptions,
featureCollectionLayerProperties: featureCollectionProperties,
mapController: mapController,
builder: builder,
polygonCulling: polygonCulling,
key: key,
),
rememberFutureResult: true,
whenDone: (Widget child) => child,
whenNotDone: const Center(child: CupertinoActivityIndicator()),
);
}