ValueListenableProvider<T> class final

Provides the value of a ValueListenable, found by its type T (not the listenable's): the widgets that watch it are rebuilt each time the listenable changes it to one that is not == (or as updateShouldNotify says).

The count of unread messages, an int below, kept by a notifier elsewhere:

ValueListenableProvider.value(
  value: unread,
  child: Builder(
    builder: (context) => Text('${context.watch<int>()} unread'),
  ),
)
Inheritance

Constructors

ValueListenableProvider.value({required ValueListenable<T> value, Key? key, UpdateShouldNotify<T>? updateShouldNotify, Widget? child})
Provides the value of value, a listenable made elsewhere.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Tells this widget apart from its siblings; see Key.
finalinherited
listenable → ValueListenable<T>
What gives the value.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
updateShouldNotify → UpdateShouldNotify<T>?
Whether the widgets that watch the value are told it went from one value to the next; null tells them when the two are not ==.
final

Methods

build(BuildContext context) → Widget
Describes this part of the interface; called when the widget is placed in the tree, whenever its parent gives it a new widget, and when its element is marked dirty.
inherited
buildWithChild(BuildContext context, Widget? child) → Widget
What this widget shows around child.
override
createElement() → StatelessElement
Inflates this widget into a new element for the tree.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Adds what describes this widget in its element's description (Element.describe) to properties, those not worth showing (a default) left out; an override calls this first. A render object widget adds only what its render object does not show. Only Element.describe calls it: a frame never does.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited