setAttachment method
void
setAttachment(
- String slotName,
- String attachmentName
)
inherited
Implementation
void setAttachment(String slotName, String attachmentName) {
final List<Slot> slots = this.slots;
final int n = slots.length;
for (int i = 0; i < n; i++) {
final Slot slot = slots[i];
if (slot.data.name == slotName) {
Attachment? attachment;
if (attachmentName.isNotEmpty) {
attachment = getAttachment(i, attachmentName);
if (attachment == null) {
throw StateError(
'Attachment not found: $attachmentName, for slot: $slotName');
}
}
slot.setAttachment(attachment);
return;
}
}
throw StateError('Slot not found: ' + slotName);
}