getSprites method

Future<GetSpritesResponse> getSprites({
  1. required ColorScheme colorScheme,
  2. required String fileName,
  3. required MapStyle style,
  4. required Variant variant,
})

GetSprites returns the map's sprites.

For more information, see Style iconography with sprites in the Amazon Location Service Developer Guide.

Parameter colorScheme : Sets the color tone for the map sprites, such as dark and light.

Example: Light

Default value: Light

Parameter fileName : Sprites API: The name of the sprite file to retrieve, following pattern sprites(@2x)?.(png|json).

Example: sprites.png

Parameter style : Style specifies the desired map style for the Sprites APIs.

Parameter variant : Optimizes map styles for specific use case or industry. You can choose allowed variant only with Standard map style.

Example: Default

Implementation

Future<GetSpritesResponse> getSprites({
  required ColorScheme colorScheme,
  required String fileName,
  required MapStyle style,
  required Variant variant,
}) async {
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri:
        '/styles/${Uri.encodeComponent(style.value)}/${Uri.encodeComponent(colorScheme.value)}/${Uri.encodeComponent(variant.value)}/sprites/${Uri.encodeComponent(fileName)}',
    exceptionFnMap: _exceptionFns,
  );
  return GetSpritesResponse(
    blob: await response.stream.toBytes(),
    cacheControl:
        _s.extractHeaderStringValue(response.headers, 'Cache-Control'),
    contentType:
        _s.extractHeaderStringValue(response.headers, 'Content-Type'),
    eTag: _s.extractHeaderStringValue(response.headers, 'ETag'),
  );
}