removeUIListener method
(en) Deletes the UI update listener 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の利用を検討してください。
subscriberId: ID to identify the subscriber to StateSlot change notifications.key: Slot for manipulating the managed value. If null, all listeners related to subscriberId will be deleted. If not null, only the listener associated with key will be deleted.
Implementation
@override
void removeUIListener({required String subscriberId, StateSlot? key}) {
if (key != null) {
// 単一 key の listener 削除
final list = _uiListeners[key];
if (list != null) {
list.removeWhere((entry) => entry.subscriberId == subscriberId);
if (list.isEmpty) _uiListeners.remove(key);
}
return;
}
// 全 key の subscriberId を削除
for (final k in _uiListeners.keys.toList()) {
final list = _uiListeners[k]!;
list.removeWhere((entry) => entry.subscriberId == subscriberId);
if (list.isEmpty) _uiListeners.remove(k);
}
}