ComputedProvider<T> class
Convenience method to pass signals with InheritedWidget
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- ProxyWidget
- InheritedWidget
- InheritedSignalProvider<
T, Computed< T> > - ComputedProvider
- Implemented types
-
- Computed<
T>
- Computed<
- Available extensions
Constructors
-
ComputedProvider({Key? key, required Widget child, required Computed<
T> create()}) - Create a new Computed by value to provide in a widget tree
-
ComputedProvider.value({Key? key, required Widget child, required Computed<
T> value}) -
Pass a Computed by value to provide in a widget tree
const
Properties
- autoDispose → bool
-
Throws and error if read after dispose and can be
disposed on last unsubscribe.
no setterinherited
- child → Widget
-
The widget below this widget in the tree.
finalinherited
- debugLabel → String?
-
Debug label for Debug Mode
no setterinherited
- disposed ↔ bool
-
Returns true if dispose has been called and will throw and
error on value read
getter/setter pairinherited
- globalId → int
-
Global ID of the signal
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSources → bool
-
Check if there are any targets attached
no setteroverride
- hasTargets → bool
-
Check if there are any targets attached
no setterinherited
- initialValue → T
-
Value that the signal was created with
no setterinherited
-
instance
→ Computed<
T> -
Internal signal
finalinherited
- isInitialized → bool
-
Check if the signal is lazy and has not had a value set
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- previousValue → T?
-
Previous value that was set before the current
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sources
→ Iterable<
ReadonlySignal> -
@internal for testing getter to track all the signals currently
subscribed in the signal
no setteroverride
-
targets
→ Iterable<
SignalListenable> -
@internal for testing getter to track all the effects currently
effected in the signal
no setterinherited
- value → T
-
Compute the current value
no setterinherited
- version → int
-
Version number is used to track changes and will increment for every set
no setterinherited
Methods
-
call(
) → T -
Return the value when invoked
inherited
-
createElement(
) → InheritedSignalElement< dynamic, ReadonlySignal> -
Inflates this configuration to a concrete instance.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
dispose(
) → void -
Dispose the signal
inherited
-
get(
) → T -
Get the current value
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
void cleanup()) → EffectCleanup -
Add a cleanup function to be called when the signal is disposed
inherited
-
overrideWith(
T value) → Computed< T> -
Override the current signal with a new value as if it was created with it
override
-
peek(
) → T -
In the rare instance that you have an effect that should write to
another signal based on the previous value, but you don't want the
effect to be subscribed to that signal, you can read a signals's
previous value via
signal.peek()
.inherited -
readonly(
) → ReadonlySignal< T> -
Returns a readonly signal
override
-
recompute(
) → void -
Call the computed function and update the value
override
-
subscribe(
void fn(T value)) → EffectCleanup -
Subscribe to value changes
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toJson(
) → dynamic -
Convert value to JSON
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
-
updateShouldNotify(
covariant InheritedSignalProvider< T, Computed< oldWidget) → boolT> > -
Whether the framework should notify widgets that inherit from this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of<
T> (BuildContext context, {bool listen = true}) → Computed< T> -
Look up a signal by its type
override