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. double zIndex = 0.0,
  13. VoidCallback? onTap,
  14. ValueChanged<LatLng>? onDrag,
  15. ValueChanged<LatLng>? onDragStart,
  16. 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; zIndex is 0.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,
  this.zIndex = 0.0,
  this.onTap,
  this.onDrag,
  this.onDragStart,
  this.onDragEnd,
}) : assert(0.0 <= alpha && alpha <= 1.0);