SubValueNotifier<T> constructor
SubValueNotifier<T> ({
- required T initialData,
- required SubValueBuild<
ValueNotifier< builder,T> > - ValueChanged<
T> ? listener, - bool initialize = false,
- SubValueKeys? keys,
Creates and subscribes to a ValueNotifier, then exposes its current state. The notifier is automatically disposed.
- The optional
listener
is called when the listenable notifies. - If
initialize
is true, thenlistener
is also called once this Widget is built for the first time.
Implementation
SubValueNotifier({
required T initialData,
required SubValueBuild<ValueNotifier<T>> builder,
ValueChanged<T>? listener,
bool initialize = false,
super.keys,
}) : super(
create: () => ValueNotifier<T>(initialData),
builder: (context, notifier) => SubValueListener<T>(
listenable: notifier,
listener: listener,
initialize: initialize,
builder: (context, value) => builder(context, notifier),
),
);