setAttachment method

void setAttachment(
  1. String slotName,
  2. String attachmentName
)

A convenience method to set an attachment by finding the slot with findSlot, finding the attachment with getAttachment, then setting the slot's attachment. The attachmentName may be an empty string to clear the slot's attachment.

Implementation

void setAttachment(String slotName, String attachmentName) {
  final slotNameNative = slotName.toNativeUtf8(allocator: _allocator);
  final attachmentNameNative = attachmentName.toNativeUtf8(allocator: _allocator);
  _bindings.spine_skeleton_set_attachment(_skeleton, slotNameNative.cast(), attachmentNameNative.cast());
  _allocator.free(slotNameNative);
  _allocator.free(attachmentNameNative);
}