custom_marker_builder 1.0.2
custom_marker_builder: ^1.0.2 copied to clipboard
A Flutter package to create dynamic custom markers for Google Maps using Flutter widgets with advanced caching and batching support.
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