set<T> method
(en) Sets the value for the specified key. The data is set without copying. Any listeners associated with the key will also be notified.
(ja) 指定されたキーに関して値をセットします。 データはコピーしないで設定されます。 キーと紐付いたリスナーにも通知されます。
key: Target slot.value: The value to set.
Implementation
@override
void set<T>(StateSlot<T> key, T value) {
if (key is! RefSlot<T>) {
throw StateError("RefAppState only supports RefSlot");
}
if (!_data.containsKey(key.name)) {
throw StateError('RefSlot "${key.name}" is not initialized');
}
_data[key.name] = value;
// 参照値用のデバッグリスナに通知。
_refDebugListener?.call(key, value);
_notify(key);
// バッチ処理中でなければ_stateListenerに通知する。
if (!_isBatch) {
_flushStateListener();
}
}