Provider<T extends Object>.value constructor
Provider<T extends Object>.value (})
Provide a value
to all descendants.
updateShouldNotify
is a callback called whenever InheritedWidget.updateShouldNotify is called.
It should return false
when there's no need to update its dependents.
Default value of updateShouldNotify
is returning true if old value is not equal to current value.
The disposer
will called when State of Provider is removed from the tree permanently (State.dispose called),
or whenever the widget configuration changes with difference value (State.didUpdateWidget called).
Implementation
factory Provider.value(
T value, {
Key? key,
void Function(T)? disposer,
bool Function(T previous, T current)? updateShouldNotify,
Widget? child,
}) {
assert(value != null);
return _ValueProvider<T>(
value: value,
disposer: disposer,
updateShouldNotify: updateShouldNotify ?? _notEquals,
child: child,
key: key,
);
}