hasImage method

bool hasImage(
  1. String id
)

Check whether or not an image with a specific ID exists in the style. This checks both images in the style's original sprite and any images that have been added at runtime using {@link addImage}.

@param id The ID of the image.

@returns {boolean} A Boolean indicating whether the image exists. @example // Check if an image with the ID 'cat' exists in // the style's sprite. var catIconExists = map.hasImage('cat');

Implementation

bool hasImage(String id) => jsObject.hasImage(id);