PowerGeoJSONMarkers class

A utility class for fetching and rendering markers from various sources.

The PowerGeoJSONMarkers class provides static methods for fetching and rendering markers from network sources, assets, files, memory, and GeoJSON strings.

Example Usage:

// Fetch and render markers from a network source
Widget networkMarkers = PowerGeoJSONMarkers.network(
  'https://example.com/markers.geojson',
  markerProperties: MarkerProperties(height: 48, width: 48),
  builder: (context, markerProperties, properties) {
    // Custom marker builder logic
    return MyCustomMarkerWidget(markerProperties: markerProperties, data: properties);
  },
  mapController: myMapController,
  key: UniqueKey(),
);

// Fetch and render markers from an asset
Widget assetMarkers = PowerGeoJSONMarkers.asset(
  'assets/markers.geojson',
  markerProperties: MarkerProperties(height: 48, width: 48),
  builder: (context, markerProperties, properties) {
    // Custom marker builder logic
    return MyCustomMarkerWidget(markerProperties: markerProperties, data: properties);
  },
  mapController: myMapController,
  key: UniqueKey(),
);

// Fetch and render markers from a file
Widget fileMarkers = PowerGeoJSONMarkers.file(
  '/path/to/markers.geojson',
  markerProperties: MarkerProperties(height: 48, width: 48),
  builder: (context, markerProperties, properties) {
    // Custom marker builder logic
    return MyCustomMarkerWidget(markerProperties: markerProperties, data: properties);
  },
  mapController: myMapController,
  key: UniqueKey(),
);

// Render markers from GeoJSON string
Widget geoJsonMarkers = PowerGeoJSONMarkers.string(
  '{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [0, 0]}}]}',
  markerProperties: MarkerProperties(height: 48, width: 48),
  builder: (context, markerProperties, properties) {
    // Custom marker builder logic
    return MyCustomMarkerWidget(markerProperties: markerProperties, data: properties);
  },
  mapController: myMapController,
  key: UniqueKey(),
);

Constructors

PowerGeoJSONMarkers()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

asset(String url, {required MarkerProperties markerProperties, MapController? mapController, Widget builder(BuildContext context, MarkerProperties markerProperties, Map<String, dynamic>? map)?, Key? key, PowerMarkerClusterOptions? powerClusterOptions}) Widget
Creates a widget that displays a marker on a map using an asset image.
defaultMarkerBuilder(BuildContext context, MarkerProperties markerProperties, Map<String, Object?>? properties, {Color? color}) Widget
Default marker builder function used to create markers for a map.
file(String file, {required MarkerProperties markerProperties, MapController? mapController, Key? key, Future<String> fileLoadBuilder(String)?, Widget builder(BuildContext context, MarkerProperties markerProperties, Map<String, dynamic>? map)?, Widget fallback(int? statusCode)?, PowerMarkerClusterOptions? powerClusterOptions}) Widget
Creates a widget that displays a marker on a map using an image file located at the specified path.
memory(Uint8List bytes, {required MarkerProperties markerLayerProperties, MapController? mapController, Key? key, Widget builder(BuildContext context, MarkerProperties markerProperties, Map<String, dynamic>? map)?, PowerMarkerClusterOptions? powerClusterOptions}) Widget
Creates a widget that displays a marker on a map using image data provided as a Uint8List.
network(String url, {Client? client, Map<String, String>? headers, List<int> statusCodes = const <int>[200], Widget builder(BuildContext context, MarkerProperties markerProperties, Map<String, dynamic>? map)?, required MarkerProperties markerProperties, MapController? mapController, Key? key, Widget fallback(int? statusCode)?, PowerMarkerClusterOptions? powerClusterOptions}) Widget
Fetches and renders markers from a network source using GeoJSON data.
string(String data, {required MarkerProperties markerProperties, MapController? mapController, Key? key, PowerMarkerClusterOptions? powerClusterOptions, Widget builder(BuildContext context, MarkerProperties markerProperties, Map<String, dynamic>? properties)?}) Widget
Creates a widget that displays a marker on a map using data provided as a String.