Custom Map Marker Builder

A high-performance Flutter package for creating dynamic Google Maps markers from standard Flutter widgets. Convert any widget into a marker with advanced caching, batching, and animation support.

πŸš€ Features Comparison

Feature 0.0.4 1.0.0
Widget to Marker βœ… βœ…
Intelligent Caching ❌ βœ…
Batch Generation ❌ βœ…
Network Images ❌ βœ…
SVG Support ❌ βœ…
Marker Clustering ❌ βœ…
Animated Markers ❌ βœ…
Render Timeouts ❌ βœ…
Quality Presets ❌ βœ…

πŸ“Έ Showcase

Showcase

πŸ“¦ Installation

Add to your pubspec.yaml:

dependencies:
  custom_marker_builder: ^1.0.0

πŸ›  Usage

βš™οΈ Global Configuration

MarkerBuilderConfig.setGlobal(MarkerBuilderConfig(
  defaultQuality: MarkerQuality.high,
  defaultCacheDuration: Duration(hours: 2),
  maxCacheSize: 150,
));

1. Simple Widget Marker

final markerIcon = await CustomMapMarkerBuilder.fromWidget(
  context: context,
  marker: MyCustomWidget(),
  cacheKey: "unique_id_123",
);

2. Batch Processing

final markers = await BatchMarkerBuilder.fromWidgetBatch(
  context: context,
  markers: [Widget1(), Widget2(), Widget3()],
  onProgress: (completed, total) => print("$completed/$total done"),
);

3. SVG Support

final markerIcon = await CustomMapMarkerBuilder.fromSvg(
  context: context,
  svgString: svgString,
  size: Size(40, 40),
);

4. Network Images

final markerIcon = await CustomMapMarkerBuilder.fromNetworkImage(
  context: context,
  imageUrl: "https://example.com/marker.png",
  loadingWidget: CircularProgressIndicator(),
);

5. Animated Markers

AnimatedMarkerBuilder.fromAnimatedWidget(
  context: context,
  builder: (value) => MyAnimatedWidget(value: value),
  duration: Duration(seconds: 1),
).listen((bitmapDescriptor) {
  // Update your marker icon in the map
});

πŸ“Š Caching System

Built-in caching prevents redundant rendering. You can monitor performance via MarkerCache.stats.

final stats = MarkerCache.stats;
print("Cache hits: ${stats['hits']}, size: ${stats['size']}");

⚠️ Migration Guide (0.0.4 to 1.0.0)

  • CustomMapMarkerBuilder.fromWidget now has optional parameters for caching and quality.
  • pixelRatio is now part of MarkerQuality but can still be overridden with customPixelRatio.
  • All methods now support renderTimeout.
  • Recommended: Provide a cacheKey to take advantage of the new caching system.

Example

Check the /example folder for a complete implementation.

License

MIT