ListenableProvider<T extends Listenable?> class

Provides a Listenable T, as Provider provides a value, and tells the widgets that depend on it each time it notifies its listeners: it listens from the first time the listenable is read until it is replaced or this widget leaves the tree.

The listenable is the one create makes, the first time it is read unless lazy is false, handed to dispose when this widget leaves the tree; or with ListenableProvider.value one made elsewhere, which a new widget may replace by another.

ListenableProvider(
  create: (context) => ScrollController(),
  dispose: (context, controller) => controller.dispose(),
  child: app,
)
Inheritance
Implementers

Constructors

ListenableProvider({required Create<T> create, Key? key, Dispose<T>? dispose, bool? lazy, TransitionBuilder? builder, Widget? child})
Provides the listenable create makes, handed to dispose, if given, when this widget leaves the tree.
ListenableProvider.value({required T value, Key? key, UpdateShouldNotify<T>? updateShouldNotify, TransitionBuilder? builder, Widget? child})
Provides value, a listenable made and disposed of elsewhere.

Properties

builder → TransitionBuilder?
Builds the child below this provider, from the one given.
finalinherited
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Tells this widget apart from its siblings; see Key.
finalinherited
lazy → bool
Whether the value is made only when it is first read; else when this widget is placed in the tree.
finalinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

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.
inherited
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