setSlot method
Implementation
bool setSlot(String slotId, String json) {
if (dotLottiePlayer != null && !isDisposed) {
try {
final player = dotLottiePlayer as JSObject;
final method = player['setSlots'.toJS] as JSFunction;
// dotlottie-web has no single-slot JSON setter; setSlots takes
// `{slotId: {p: value}}` and only touches the slots it is given.
final slot = JSObject();
slot['p'.toJS] = _jsonParse(json);
final slots = JSObject();
slots[slotId.toJS] = slot;
method.callAsFunction(player, slots);
return true;
} catch (e) {
return false;
}
}
return false;
}