目录

Marker

Defines an icon placed at a specified position on a map.

Properties

Name

Type

Description

markerId

MarkerId

Unique marker ID.

position

LatLng

Position of a marker.

infoWindow

InfoWindow

Information window of a marker.

anchor

Offset

Anchor point of a marker.

draggable

bool

Indicates whether a marker can be dragged. The options are true (yes) and false (no).

flat

bool

Indicates whether to flatly attach a marker to the map. If the marker is flatly attached to the map, it will stay on the map when the camera rotates or tilts. The marker will remain the same size when the camera zooms in or out. If the marker faces the camera, it will always be drawn facing the camera and rotates or tilts with the camera.

icon

BitmapDescriptor

Marker icon to render.

rotation

double

Rotation angle of a marker, in degrees.

alpha

double

Opacity. The value ranges from 0 (completely transparent) to 1 (completely opaque).

visible

bool

Indicates whether a marker is visible. The options are true (yes) and false (no).

zIndex

double

Z-index of a marker. The z-index indicates the overlapping order of a marker. A marker with a larger z-index overlaps that with a smaller z-index. Markers with the same z-index overlap each other in a random order. By default, the z-index is 0.

clickable

bool

Indicates whether a marker can be tapped. The options are true (yes) and false (no).

clusterable

bool

Indicates whether a marker can be clustered.

onClick

VoidCallback?

Callback executed when a marker is tapped.

onDragEnd

ValueChanged<LatLng>?

Callback executed when marker dragging is finished.

onDragStart

ValueChanged<LatLng>?

Callback executed when marker dragging is started.

onDrag

ValueChanged<LatLng>?

Callback executed while a marker is being dragged.

animationSet

List<dynamic>

Animation set.

Constructor Summary

Constructors

[h2]Marker

Creates a Marker object.

Parameter

Type

Description

markerId

MarkerId

Unique marker ID.

position

LatLng

Position of a marker.

infoWindow

InfoWindow

Information window of a marker.

anchor

Offset

Anchor point of a marker.

draggable

bool

Indicates whether a marker can be dragged. The options are true (yes) and false (no).

flat

bool

Indicates whether to flatly attach a marker to the map. If the marker is flatly attached to the map, it will stay on the map when the camera rotates or tilts. The marker will remain the same size when the camera zooms in or out. If the marker faces the camera, it will always be drawn facing the camera and rotates or tilts with the camera.

icon

BitmapDescriptor

Marker icon to render.

rotation

double

Rotation angle of a marker, in degrees.

alpha

double

Opacity. The value ranges from 0 (completely transparent) to 1 (completely opaque).

visible

bool

Indicates whether a marker is visible. The options are true (yes) and false (no).

zIndex

double

Z-index of a marker. The z-index indicates the overlapping order of a marker. A marker with a larger z-index overlaps that with a smaller z-index. Markers with the same z-index overlap each other in a random order. By default, the z-index is 0.

clickable

bool

Indicates whether a marker can be tapped. The options are true (yes) and false (no).

clusterable

bool

Indicates whether a marker can be clustered.

onClick

VoidCallback?

Callback executed when a marker is tapped.

onDragEnd

ValueChanged<LatLng>?

Callback executed when marker dragging is finished.

onDragStart

ValueChanged<LatLng>?

Callback executed when marker dragging is started.

onDrag

ValueChanged<LatLng>?

Callback executed while a marker is being dragged.

animationSet

List<dynamic>

Animation set.

Method Summary

Methods

[h2]Marker.updateCopy

Copies an existing Marker object and updates the specified attributes.

Parameter

Type

Description

position

LatLng?

Position of a marker.

infoWindow

InfoWindow?

Information window of a marker.

anchor

Offset?

Anchor point of a marker.

draggable

bool?

Indicates whether a marker can be dragged. The options are true (yes) and false (no).

flat

bool?

Indicates whether to flatly attach a marker to the map. If the marker is flatly attached to the map, it will stay on the map when the camera rotates or tilts. The marker will remain the same size when the camera zooms in or out. If the marker faces the camera, it will always be drawn facing the camera and rotates or tilts with the camera.

icon

BitmapDescriptor?

Marker icon to render.

rotation

double?

Rotation angle of a marker, in degrees.

alpha

double?

Opacity. The value ranges from 0 (completely transparent) to 1 (completely opaque).

visible

bool?

Indicates whether a marker is visible. The options are true (yes) and false (no).

zIndex

double?

Z-index of a marker. The z-index indicates the overlapping order of a marker. A marker with a larger z-index overlaps that with a smaller z-index. Markers with the same z-index overlap each other in a random order. By default, the z-index is 0.

clickable

bool?

Indicates whether a marker can be tapped. The options are true (yes) and false (no).

clusterable

bool?

Indicates whether a marker can be clustered.

onClick

VoidCallback?

Callback executed when a marker is tapped.

onDragEnd

ValueChanged<LatLng>?

Callback executed when marker dragging is finished.

onDragStart

ValueChanged<LatLng>?

Callback executed when marker dragging is started.

onDrag

ValueChanged<LatLng>?

Callback executed while a marker is being dragged.

animationSet

List<dynamic>?

Animation set.

Return Type

Description

Marker

Marker object.

Call example:

// Define a Marker object.
Marker marker; 
 
// Call the updateCopy method.
marker = marker!.updateCopy(draggable: true);

[h2]Marker.clone

Clones a Marker object.

Return Type

Description

Marker

Marker object.

Call example:

// Define a Marker object.
Marker marker; 
Marker marker2; 
 
// Call the clone method.
marker2 = marker!.clone();