stateFor<T> method
Retrieves existing state owned by this element by type and key. Throws a StateError if no matching state is registered.
Implementation
ValueState<T> stateFor<T>({
required Key key,
StateMode mode = .watch,
}) {
return stateOf<T>(
() => throw StateError('No state registered for type $T and key $key.'),
key: key,
mode: mode,
);
}