useNotifier<V> method
Retrieves an existing ValueNotifier or creates a new one.
key
: A unique string key to identify the ValueNotifier.
initialValue
: The initial value of the ValueNotifier.
Returns a ValueNotifier associated with the given key.
Implementation
ValueNotifier<V> useNotifier<V>({
required String key,
required V initialValue,
}) {
return _getOrCreate(
key: key,
create: () => ValueNotifier<V>(initialValue),
disposeHandler: (notifier) async => notifier.dispose());
}