DeferredInheritedProvider<C, T> class

Provides a T whose values a controller C gives over time, as a future or a stream gives them: FutureProvider and StreamProvider are made of it.

The controller is the one create makes, the first time the value is read unless lazy is false, and handed to dispose when this widget leaves the tree; or with DeferredInheritedProvider.value one made elsewhere, which a new widget may replace by another. startListening is called with it when the value is first read and hands its values to setState, the first before it returns; each value after it that is not == the one before (or as updateShouldNotify says) tells the dependents.

The latest of a stream's lines, '' before the first, as a StreamProvider provides them:

DeferredInheritedProvider<Stream<String>, String>(
  create: (context) => statusLines,
  startListening: (element, setState, stream, value) {
    setState(value ?? '');
    return stream.listen(setState).cancel;
  },
  child: app,
)
Inheritance
Implementers

Constructors

DeferredInheritedProvider({required Create<C> create, required DeferredStartListening<C, T> startListening, Key? key, Dispose<C>? dispose, UpdateShouldNotify<T>? updateShouldNotify, bool? lazy, TransitionBuilder? builder, Widget? child})
Provides the values of the controller create makes.
DeferredInheritedProvider.value({required C value, required DeferredStartListening<C, T> startListening, Key? key, UpdateShouldNotify<T>? updateShouldNotify, bool? lazy, TransitionBuilder? builder, Widget? child})
Provides the values of value, a controller made 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