Marker constructor

const Marker({
  1. required MarkerId markerId,
  2. double alpha = 1.0,
  3. Offset anchor = const Offset(0.5, 1.0),
  4. bool consumeTapEvents = false,
  5. bool draggable = false,
  6. bool flat = false,
  7. BitmapDescriptor icon = BitmapDescriptor.defaultMarker,
  8. InfoWindow infoWindow = InfoWindow.noText,
  9. LatLng position = const LatLng(0.0, 0.0),
  10. double rotation = 0.0,
  11. bool visible = true,
  12. @Deprecated('Use zIndexInt instead. ' 'On some platforms zIndex is truncated to an int, which can lead to incorrect/unstable ordering.') double zIndex = 0.0,
  13. int zIndexInt = 0,
  14. ClusterManagerId? clusterManagerId,
  15. VoidCallback? onTap,
  16. ValueChanged<LatLng>? onDrag,
  17. ValueChanged<LatLng>? onDragStart,
  18. ValueChanged<LatLng>? onDragEnd,
})

Creates a set of marker configuration options.

Default marker options.

Specifies a marker that

  • is fully opaque; alpha is 1.0
  • uses icon bottom center to indicate map position; anchor is (0.5, 1.0)
  • has default tap handling; consumeTapEvents is false
  • is stationary; draggable is false
  • is drawn against the screen, not the map; flat is false
  • has a default icon; icon is BitmapDescriptor.defaultMarker
  • anchors the info window at top center; infoWindowAnchor is (0.5, 0.0)
  • has no info window text; infoWindowText is InfoWindowText.noText
  • is positioned at 0, 0; position is LatLng(0.0, 0.0)
  • has an axis-aligned icon; rotation is 0.0
  • is visible; visible is true
  • is placed at the base of the drawing order; zIndexInt is 0
  • reports onTap events
  • reports onDragEnd events

Implementation

const Marker({
  required this.markerId,
  this.alpha = 1.0,
  this.anchor = const Offset(0.5, 1.0),
  this.consumeTapEvents = false,
  this.draggable = false,
  this.flat = false,
  this.icon = BitmapDescriptor.defaultMarker,
  this.infoWindow = InfoWindow.noText,
  this.position = const LatLng(0.0, 0.0),
  this.rotation = 0.0,
  this.visible = true,
  @Deprecated(
    'Use zIndexInt instead. '
    'On some platforms zIndex is truncated to an int, which can lead to incorrect/unstable ordering.',
  )
  double zIndex = 0.0,
  int zIndexInt = 0,
  this.clusterManagerId,
  this.onTap,
  this.onDrag,
  this.onDragStart,
  this.onDragEnd,
}) : assert(0.0 <= alpha && alpha <= 1.0),
     assert(
       zIndex == 0.0 || zIndexInt == 0,
       'Only one of zIndex and zIndexInt can be provided',
     ),
     _zIndexNum = zIndexInt == 0 ? zIndex : zIndexInt;