addStyleImage method

Future<void> addStyleImage(
  1. String imageId,
  2. double scale,
  3. MbxImage image,
  4. bool sdf,
  5. List<ImageStretches?> stretchX,
  6. List<ImageStretches?> stretchY,
  7. ImageContent? content,
)

Adds an image to be used in the style. This API can also be used for updating an image. If the image for a given imageId was already added, it gets replaced by the new image.

The image can be used in icon-image, fill-pattern, line-pattern and text-field properties.

@param imageId An identifier of the image. @param scale A scale factor for the image. @param image A pixel data of the image. @param sdf An option to treat whether image is SDF(signed distance field) or not. @param stretchX An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched horizontally. @param stretchY An array of two-element arrays, consisting of two numbers that represent the from position and the to position of areas that can be stretched vertically. @param content An array of four numbers, with the first two specifying the left, top corner, and the last two specifying the right, bottom corner. If present, and if the icon uses icon-text-fit, the symbol's text will be fit inside the content box.

@return A string describing an error if the operation was not successful, empty otherwise.

Implementation

Future<void> addStyleImage(
    String imageId,
    double scale,
    MbxImage image,
    bool sdf,
    List<ImageStretches?> stretchX,
    List<ImageStretches?> stretchY,
    ImageContent? content) async {
  final String pigeonVar_channelName =
      'dev.flutter.pigeon.mapbox_maps_flutter.StyleManager.addStyleImage$pigeonVar_messageChannelSuffix';
  final BasicMessageChannel<Object?> pigeonVar_channel =
      BasicMessageChannel<Object?>(
    pigeonVar_channelName,
    pigeonChannelCodec,
    binaryMessenger: pigeonVar_binaryMessenger,
  );
  final List<Object?>? pigeonVar_replyList = await pigeonVar_channel.send(
          <Object?>[imageId, scale, image, sdf, stretchX, stretchY, content])
      as List<Object?>?;
  if (pigeonVar_replyList == null) {
    throw _createConnectionError(pigeonVar_channelName);
  } else if (pigeonVar_replyList.length > 1) {
    throw PlatformException(
      code: pigeonVar_replyList[0]! as String,
      message: pigeonVar_replyList[1] as String?,
      details: pigeonVar_replyList[2],
    );
  } else {
    return;
  }
}