Map controller for HuaweiMap.
Method | Return Type | Description |
|---|---|---|
Future<void> | Clears the cache of a tile overlay. | |
Future<void> | Starts the animation of a marker. | |
Future<void> | Updates the camera position in animation mode. | |
Future<void> | Stops the current animation of the camera. When this method is called, the camera stops moving immediately and remains in that position. | |
Future<void> | Updates the camera position. The movement is instantaneous. | |
Future<void> | Sets the map style. | |
Future<void> | Sets the location for the location source. | |
Future<void> | Sets the location source for the my-location layer. | |
Future<void> | Deactivates the location source. | |
Future<LatLngBounds> | Obtains the visible region after conversion between the screen coordinates and longitude-latitude coordinates. | |
Future<ScreenCoordinate> | Obtains a location on the screen corresponding to the specified longitude-latitude coordinates. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen). | |
Future<LatLng> | Obtains the longitude and latitude of a location on the screen. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen). | |
Future<void> | Displays the information window for a marker. | |
Future<void> | Hides the information window for a marker. This method is invalid for invisible markers. | |
Future<bool?> | Checks whether an information window is currently displayed for a marker. This method will not consider whether the information window is actually visible on the screen. | |
Future<bool?> | Checks whether a marker can be clustered. | |
Future<double?> | Obtains the zoom level of a map. | |
Future<Uint8List?> | Takes a snapshot of a map. |
Clears the cache of a tile overlay. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
tileOverlay | TileOverlay object. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and TileOverlay. HuaweiMapController mapController; TileOverlay tileOverlay; // Call the clearTileCache API. await mapController.clearTileCache(tileOverlay);
Starts the animation of a marker. The method is asynchronous.
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and a Marker object with an animation. HuaweiMapController mapController; Marker marker; // Call the startAnimationOnMarker API. await mapController.startAnimationOnMarker(marker!);
Updates the camera position in animation mode. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
cameraUpdate | Camera position change. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and a CameraUpdate object. HuaweiMapController mapController; CameraUpdate cameraUpdate; // Call the animateCamera API. await mapController.animateCamera(cameraUpdate);
Stops the current animation of the camera. When this method is called, the camera stops moving immediately and remains in that position.
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the stopAnimation API. await mapController.stopAnimation();
Updates the camera position in instantaneous mode. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
cameraUpdate | Camera position change. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and a CameraUpdate object. HuaweiMapController mapController; CameraUpdate cameraUpdate; // Call the moveCamera API. await mapController.moveCamera(cameraUpdate);
Sets the map style. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
mapStyle | String | Map style as a JSON string. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController.
HuaweiMapController mapController;
// Call the setMapStyle API.
await mapController.setMapStyle("YOUR_MAP_STYLE_AS_JSON"); Sets the location for the location source.
Parameter | Type | Description |
|---|---|---|
latLng | Preferred location. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the setLocation API. await mapController.setLocation(latLng);
Sets the location source for the my-location layer.
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the setLocationSource API. await mapController.setLocationSource();
Deactivates the location source.
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the deactivateLocationSource API. await mapController.deactivateLocationSource();
Obtains the visible region after conversion between the screen coordinates and longitude-latitude coordinates. The method is asynchronous.
Return Type | Description |
|---|---|
Future<LatLngBounds> | Smallest bounding box that includes the visible region. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the getVisibleRegion API. LatLngBounds bounds = await mapController.getVisibleRegion();
Obtains a location on the screen corresponding to the specified longitude-latitude coordinates. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen). The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
latLng | Longitude and latitude of a location on the map. |
Return Type | Description |
|---|---|
Future<ScreenCoordinate> | Coordinates of a location on the screen, in pixels. |
Call example:
// Define HuaweiMapController and a LatLng object. HuaweiMapController mapController; LatLng latLng; // Call the getScreenCoordinate API. ScreenCoordinate coordinate = await mapController.getScreenCoordinate(latLng);
Obtains the longitude and latitude of a location on the screen. The location on the screen is specified in screen pixels (instead of display pixels) relative to the top left corner of the map (instead of the top left corner of the screen). The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
screenCoordinate | Coordinates of a location on the screen, in pixels. |
Return Type | Description |
|---|---|
Future<LatLng> | LatLng object that contains the corresponding longitude and latitude. |
Call example:
// Define HuaweiMapController and a ScreenCoordinate object. HuaweiMapController mapController; ScreenCoordinate screenCoordinate; // Call the getLatLng API. LatLng latLng = await mapController.getLatLng(screenCoordinate);
Displays the information window for a marker. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
markerId | Marker ID. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and a Marker object with an information window. HuaweiMapController mapController; Marker marker; // Call the showMarkerInfoWindow API. await mapController.showMarkerInfoWindow(marker.markerId);
Hides the information window for a marker. This method is asynchronous and invalid for invisible markers.
Parameter | Type | Description |
|---|---|---|
markerId | Marker ID. |
Return Type | Description |
|---|---|
Future<void> | Future result of an execution that returns no value. |
Call example:
// Define HuaweiMapController and a Marker object with an information window. HuaweiMapController mapController; Marker marker; // Call the hideMarkerInfoWindow API. await mapController.hideMarkerInfoWindow(marker.markerId);
Checks whether an information window is currently displayed for a marker. This method is asynchronous and will not consider whether the information window is actually visible on the screen.
Parameter | Type | Description |
|---|---|---|
markerId | Marker ID. |
Return Type | Description |
|---|---|
Future<bool?> | true if an information window is currently displayed for a marker; false otherwise. |
Call example:
// Define HuaweiMapController and a Marker object with an information window. HuaweiMapController mapController; Marker marker; // Call the isMarkerInfoWindowShown API. bool? status = await mapController.isMarkerInfoWindowShown(marker.markerId);
Checks whether a marker can be clustered. The method is asynchronous.
Parameter | Type | Description |
|---|---|---|
markerId | Marker ID. |
Return Type | Description |
|---|---|
Future<bool?> | true if the marker can be clustered; false otherwise. |
Call example:
// Define HuaweiMapController and a Marker object with the clusterable feature. HuaweiMapController mapController; Marker marker; // Call the isMarkerClusterable API. bool? isClusterable = await mapController.isMarkerClusterable(marker.markerId);
Obtains the zoom level of a map. The method is asynchronous.
Return Type | Description |
|---|---|
Future<double?> | Zoom level. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the getZoomLevel API. double? zoomLevel = await mapController.getZoomLevel();
Takes a snapshot of a map. The method is asynchronous.
Return Type | Description |
|---|---|
Future<Uint8List?> | Uint8List data of an image. |
Call example:
// Define HuaweiMapController. HuaweiMapController mapController; // Call the takeSnapshot API. Uint8List? imageData = await mapController.takeSnapshot();