SignalProvider<T> class

Convenience method to pass signals with InheritedWidget

Inheritance
Implemented types
Available extensions

Constructors

SignalProvider({Key? key, required Widget child, required Signal<T> create()})
Create a new Signal by value to provide in a widget tree
SignalProvider.value({Key? key, required Widget child, required Signal<T> value})
Pass a Signal by value to provide in a widget tree

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
equalityCheck bool Function(T a, T b)
Optional method to check if to values are the same
getter/setter pairoverride
globalId int
Global ID of the signal
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasTargets bool
Check if there are any targets attached
no setterinherited
initialValue → T
Value that the signal was created with
no setterinherited
instance Signal<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
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
getter/setter pairinherited-getteroverride-setter
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
forceUpdate([T? val]) → void
Force update a value
override
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) Signal<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
set(T val, {bool force = false}) bool
Update the current 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, Signal<T>> oldWidget) bool
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}) Signal<T>
Look up a signal by its type
override