marker_widget 2.1.0-dev.1
marker_widget: ^2.1.0-dev.1 copied to clipboard
Render Flutter widgets into google_maps_flutter bitmaps, glyphs, markers, and ground overlays with caching and modern Flutter View APIs.
Changelog #
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.1.0-dev.1 - 2026-07-21 #
Hardening prerelease. All changes are backward compatible for correct usage; several misuses that previously produced silently wrong output now throw.
Fixed #
- The off-screen render tree is now fully unmounted after capture, so
State.disposeruns for stateful marker widgets and resources they hold (timers, controllers, subscriptions) are released per render. All manually created render objects and the capturedui.Imageare disposed even when a setup step or PNG encoding throws. - Cache identity now combines the cache key with the resolved logical size and
pixel ratio. Reusing one
cacheKeyat a different size or pixel ratio (sequentially or concurrently) renders a fresh icon instead of returning the previously cached, wrongly sized one. - Screen geometry no longer leaks into rendered markers: safe-area padding,
keyboard insets, system gesture insets, and display features are zeroed in
the render tree's
MediaQuery, so aSafeAreainside a marker renders edge to edge. Accessibility values (text scaling, brightness, bold text) are still inherited. removeFromCacheno longer grows internal bookkeeping for every key it is ever called with; invalidation state now lives only while a render is in flight.
Added #
MarkerIconRenderer.maxConcurrentRenders(default 3): a FIFO gate on how many off-screen render trees exist at once, bounding transient memory during batch rendering. Set to null to disable.MarkerIconRenderer.maxRasterPixels(default 4194304, one 2048 x 2048 physical bitmap): renders whose physical pixel count exceeds the budget throwArgumentErrorinstead of allocating enormous bitmaps. Set to null to disable.- Re-exports of the remaining Google Maps types used by the package API:
Marker,MarkerId,LatLng,LatLngBounds,InfoWindow,BitmapDescriptor,MapBitmap,BytesMapBitmap,MapBitmapScaling,GroundOverlay, andGroundOverlayId. The whole marker flow now works from themarker_widgetimport alone.
Changed #
MarkerIcon.toMapBitmap/toBitmapDescriptorreturn the identicalBytesMapBitmapinstance for repeated calls with equal options on the same icon. Rebuilt markers therefore stay equal to their previous versions and google_maps_flutter no longer pushes redundant platform-side icon updates for unchanged markers.- Dimensions and ratios are validated as positive and finite everywhere:
NaN and infinity are rejected with descriptive
ArgumentError/StateErrorinstead of propagating to the platform. MarkerIconRendererconstructor configuration is validated at runtime withArgumentError(previously a debug-only assert coveredmaxCacheEntriesonly).MarkerIcon.toMarkerand the widgettoMarkerextension throwArgumentErrorwhen the base is anAdvancedMarker, which would otherwise silently flow through the classic marker pipeline; usetoAdvancedMarkerortoAdvancedPinMarker.- Contextless rendering in a multi-view app with no implicit view now throws a
StateErrorasking for aBuildContextinstead of picking an arbitraryFlutterView. removeFromCacheremoves every size/pixel-ratio variant of the key,isCachedmatches any variant,peekCachereturns the most recently used variant, andcacheSizecounts each variant as one entry.
2.0.1 - 2026-07-18 #
Added #
- AI coding-assistant support, installable from the GitHub repository for both
Claude Code and OpenAI Codex (
plugins/marker-widgetplus repo marketplace catalogs). Includes four package-specific skills (integration and sizing, caching and performance tuning, symptom-based troubleshooting, and a guided v1-to-v2 migration), a read-only marker_widget reviewer agent for Claude Code, shared API references, and an evaluation suite. See "AI coding-assistant support" in the README. The plugin tree is excluded from the pub.dev archive; the Dart package itself is unchanged. - Repository maintainer guidance (
AGENTS.md, imported byCLAUDE.md) and a structural validator (tool/validate_agent_plugin.dart) wired into CI.
Changed #
dart pub publisharchive no longer contains leftover emptylib/src/directories.- The pub.dev publish workflow now runs exclusively on release tags
(
workflow_dispatchtrigger removed).
No runtime, API, or dependency changes.
2.0.0 - 2026-03-08 #
Breaking #
- Removed
MarkerIconScalingMode. - Replaced the old flat scaling parameters with:
WidgetBitmapRenderOptionsfor off-screen renderingMapBitmapOptionsfor map bitmap output
- Updated
MarkerIconRenderer.render()to acceptWidgetBitmapRenderOptions. - Renamed
Widget.toMarkerBitmap()toWidget.toBitmapDescriptor(). - Removed the top-level
widgetTo*helpers in favor of widget extensions with optional namedcontext. - Removed
MarkerBuildOptionsandAdvancedMarkerBuildOptions. Marker builder APIs now accept real upstreamMarkerandAdvancedMarkerobjects. - Updated widget extensions to use optional named
context,renderOptions, andbitmapOptions. - Replaced
MapBitmapOptions.renderedDpr()withMapBitmapOptions.pixelPerfect(). - Raised the minimum supported SDK versions to Flutter 3.41.4 and Dart 3.10.
Added #
MapBitmapOptionsandWidgetBitmapRenderOptionsvalue objects.MapBitmapOptions.pixelPerfect()for pixel-perfect display using the rendered widget DPR.MarkerIcon.toGroundOverlayBitmap().MarkerIcon.toBitmapGlyph().MarkerIcon.toPinConfig().MarkerIcon.toMarker()andMarkerIcon.toAdvancedMarker().MarkerIcon.toAdvancedPinMarker()for one-call widget-to-pin-marker flow.- Widget extension helpers:
toGroundOverlayBitmap()toBitmapGlyph()toPinConfig()toMarker()toAdvancedMarker()toAdvancedPinMarker()
buildClusterCacheKey().buildMarkerCacheKey(extra: ...)for additional visual-state cache inputs.defaultMarkerIconRendererexposed for cache inspection, clearing, and prewarming.Equatableon all value objects for structural equality.- Curated re-exports for advanced marker types that are missing from
google_maps_flutter.
Changed #
MapBitmapScaling.noneis now supported through raw bitmap conversion.toGroundOverlayBitmap()is a discoverability alias for the rawMapBitmapScaling.nonepath.- Renderer context capture now includes
LocalizationsandDefaultAssetBundle, not just themes andMediaQuery. - Cache invalidation now blocks stale in-flight renders from repopulating cache
after
clearCache()orremoveFromCache(). - README and example app now demonstrate base
Marker/AdvancedMarkerinputs, advanced marker pins, and ground overlays.
1.1.0 - 2025-12-04 #
Added #
MarkerIcon.toMapBitmap(): ReturnsBytesMapBitmapdirectly for users who need the concrete type for storage or interoperability.MarkerIcon.sizeInBytes: Getter for memory tracking.- Memory-based cache eviction: New
maxCacheBytesparameter (default 50 MB) onMarkerIconRendererto prevent unbounded memory growth. - Concurrent render deduplication: Multiple simultaneous calls with the same
cacheKeynow share a single render operation instead of duplicating work. - Cache introspection:
MarkerIconRenderer.cacheSize— current entry count.MarkerIconRenderer.cacheSizeInBytes— current memory usage.MarkerIconRenderer.isCached(key)— check if a key exists.MarkerIconRenderer.peekCache(key)— get without LRU bump.
- New extension methods on
Widget:toMapBitmap()— returnsBytesMapBitmapdirectly.toMarkerIcon()— returnsMarkerIconfor storage and later conversion.
- New standalone functions:
widgetToMapBitmap()— convenience withoutBuildContext, returnsBytesMapBitmap.widgetToMarkerIcon()— convenience withoutBuildContext, returnsMarkerIcon.
@immutableannotation onMarkerIconfor correctness.- Enhanced documentation: Added "Render Once, Reuse Everywhere" pattern examples in README and class docs.
Changed #
MapBitmapScaling.nonevalidation: Now throwsStateErrorfor both scaling modes (not justimagePixelRatio). This was already invalid at the platform level; the error message is now clearer and fails earlier.- Improved code style: explicit type annotations throughout for better readability.
- Updated README with performance tips, memory management guidance, and static vs dynamic marker strategies.
1.0.0 - 2025-11-24 #
Added #
- Initial release of marker_widget.
- Off-screen renderer that converts any
Widgetinto PNG bytes using:RenderView+ViewConfigurationwith logical & physical constraints.RepaintBoundaryand explicitPipelineOwner/BuildOwnerlifecycle.
MarkerIconvalue object that encapsulates:- PNG bytes.
- Logical size.
- Device pixel ratio.
- Conversion to
BitmapDescriptor.byteswithMapBitmapScaling.
MarkerIconRenderer:- Configurable default logical size.
- Optional LRU-based in-memory cache with size limit.
- Optional image-aware second pass via
waitForImages.
MarkerIconScalingMode:logicalSizemode (stable logical size, default).imagePixelRatiomode (pixel-perfect usingimagePixelRatio).
WidgetMarkerExtension.toMarkerBitmap:- Convert any widget into a
BitmapDescriptorusing the default (or injected) renderer. - Supports
waitForImages, custom pixel ratio, bitmap scaling, and scaling mode.
- Convert any widget into a
- Top-level
widgetToMarkerBitmaphelper for use without aBuildContext. buildMarkerCacheKeyhelper for theme/locale/size-aware marker caching.- Example app demonstrating:
- Basic usage with a custom card-like marker.
- Toggling between logical-size and image-pixel-ratio scaling modes.