addSource method

MapboxMap addSource(
  1. String id,
  2. dynamic source
)

Adds a source to the map's style.

@param {string} id The ID of the source to add. Must not conflict with existing sources. @param {Object} source The source object, conforming to the Mapbox Style Specification's source definition or {@link CanvasSourceOptions}. @fires source.add @returns {MapboxMap} this @example map.addSource('my-data', { type: 'vector', url: 'mapbox://myusername.tilesetid' }); @example map.addSource('my-data', { "type": "geojson", "data": { "type": "Feature", "geometry": { "type": "Point", "coordinates": -77.0323, 38.9131 }, "properties": { "title": "Mapbox DC", "marker-symbol": "monument" } } }); @see Vector source: Show and hide layers @see GeoJSON source: Add live realtime data @see Raster DEM source: Add hillshading

Implementation

MapboxMap addSource(String id, dynamic source) {
  if (source is Source) {
    return MapboxMap.fromJsObject(jsObject.addSource(id, source.jsObject));
  }
  return MapboxMap.fromJsObject(jsObject.addSource(id, jsify(source)));
}