addUIListener method
(en) Adds a listener for UI updates associated with the specified slot and ID. Normally, you should not use this directly. Instead, consider using a class that extends SlotStatefulWidget or StateSlotBuilder.
(ja) 指定スロット、及びIDに紐付いたUI更新用のリスナを追加します。 通常はこれを直接使用せず、SlotStatefulWidgetを拡張したクラスか StateSlotBuilderの利用を検討してください。
key: A slot for manipulating the managed value.subscriberId: An ID for identifying the subscriber to StateSlot change notifications. One is assigned per State (widget), and even if the same State subscribes to multiple slots, only one notification for screen updates will be sent.callback: A callback that is triggered when the key value changes.
Implementation
@override
void addUIListener(
StateSlot key,
String subscriberId,
void Function() callback,
) {
final list = _uiListeners.putIfAbsent(key, () => []);
list.add(_ListenerEntry(subscriberId, callback));
}