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

📦 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.fromWidgetnow has optional parameters for caching and quality.pixelRatiois now part ofMarkerQualitybut can still be overridden withcustomPixelRatio.- All methods now support
renderTimeout. - Recommended: Provide a
cacheKeyto take advantage of the new caching system.
Example
Check the /example folder for a complete implementation.
License
MIT