addControl method

MapboxMap addControl(
  1. dynamic control, [
  2. String? position
])

Adds an {@link IControl} to the map, calling control.onAdd(this).

@param {IControl} control The {@link IControl} to add. @param {string} position position on the map to which the control will be added. Valid values are 'top-left', 'top-right', 'bottom-left', and 'bottom-right'. Defaults to 'top-right'. @returns {MapboxMap} this @example // Add zoom and rotation controls to the map. map.addControl(new NavigationControl()); @see Display map navigation controls

Implementation

MapboxMap addControl(dynamic control, [String? position]) {
  if (position != null) {
    return MapboxMap.fromJsObject(
        jsObject.addControl(control.jsObject, position));
  }
  return MapboxMap.fromJsObject(jsObject.addControl(control.jsObject));
}