SignalSelector<T, S> class
============================================================================ SIGNAL SELECTOR (GRANULAR REBUILDS)
Select a part of a signal's value for granular rebuilds.
SignalSelector creates a derived signal that only updates when the selected part of the value changes.
Basic Usage
class User {
final String name;
final int age;
User(this.name, this.age);
}
final user = Signal(User('Alice', 25));
// Only emits when name changes
final nameSignal = SignalSelector(user, (u) => u.name);
nameSignal.addListener(() {
print('Name changed: ${nameSignal.value}');
});
- Inheritance
-
- Object
- NeuronAtom<
S> - Signal<
S> - SignalSelector
- Available extensions
Constructors
-
SignalSelector(Signal<
T> source, S selector(T value), {String? debugLabel})
Properties
- debugLabel → String?
-
Debug label for identification in DevTools.
finalinherited
- equals → bool Function(S a, S b)?
-
Custom equality function to determine if value has changed.
finalinherited
- guard → S Function(S current, S next)?
-
Value guard/transformer called before setting a new value.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether this atom has any listeners.
no setterinherited
- initialValue → S
-
The initial value of the atom.
no setterinherited
- isDisposed → bool
-
Whether this atom has been disposed.
no setterinherited
- onCancel → VoidCallback?
-
Callback invoked when the last listener unsubscribes.
finalinherited
- onListen → VoidCallback?
-
Callback invoked when the first listener subscribes.
finalinherited
- previousValue → S?
-
The previous value of the atom (before the last change).
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selector → S Function(T value)
-
final
-
source
→ Signal<
T> -
final
-
stream
→ Stream<
S> -
A broadcast stream of value changes.
no setterinherited
- val → S
-
Short alias for the current value.
no setteroverride
- value ↔ S
-
When cold (no listeners), always recompute from source.
getter/setter pairinherited-setteroverride-getter
Methods
-
add(
num amount) → void -
Available on Signal<
AddT> , provided by the SignalExtensions extensionamountto numeric signal and emit. Alias for increment. -
addListener(
VoidCallback listener) → AtomListener -
Adds a listener to be called when the value changes.
inherited
-
animated(
{required Widget to(BuildContext context, T value), Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, SlotEffect effect = SlotEffect.fade, DirectionalEffect? directionalEffect}) → Widget -
Available on Signal<
Create an AnimatedSlot with elegant syntax.T> , provided by the SignalSlotExtensions extension -
bind(
NeuronController parent) → T -
Available on T, provided by the SignalBinding extension
Registers this notifier to be disposed withparent. -
bouncy(
{required Widget to(BuildContext context, double animatedValue)}) → Widget -
Available on Signal<
Create a bouncy spring animation.T> , provided by the NumericSignalSlotExtensions extension -
debounce(
Duration duration) → DebouncedSignal< T> -
Available on Signal<
Create a debounced version of this signal.T> , provided by the SignalHelpers extension -
debounced(
{required Widget to(BuildContext context, T value), Duration duration = const Duration(milliseconds: 300)}) → Widget -
Available on Signal<
Create a debounced slot.T> , provided by the SignalSlotExtensions extension -
dec(
[num by = 1]) → void -
Available on Signal<
Short alias for decrement. Decrements numeric signal byT> , provided by the SignalExtensions extensionby(default 1). -
decrement(
[num by = 1]) → void -
Available on Signal<
Decrement numeric signal.T> , provided by the SignalExtensions extension -
dispose(
) → void -
Disposes the atom, removing all listeners.
override
-
distinct(
) → DistinctSignal< T> -
Available on Signal<
Create a distinct version of this signal.T> , provided by the SignalHelpers extension -
emit(
S val) → void -
Assigns a new value and notifies listeners if the value changed.
inherited
-
expandCollapseMorph(
{double size = 24, Color? color, IconMorphStyle style = IconMorphStyle.rotateScale}) → Widget -
Available on Signal<
Create an expand/collapse icon morph.bool> , provided by the BooleanMorphExtensions extension -
favoriteMorph(
{double size = 24, Color? activeColor, Color? inactiveColor, IconMorphStyle style = IconMorphStyle.scale}) → Widget -
Available on Signal<
Create a favorite toggle icon morph.bool> , provided by the BooleanMorphExtensions extension -
form(
{required Widget to(BuildContext context, T value, FormValidationResult validation, bool isFocused), String? validator(T value)?, FormAnimationEffect errorEffect = FormAnimationEffect.shake, FormAnimationEffect successEffect = FormAnimationEffect.pulse, Duration animationDuration = const Duration(milliseconds: 300)}) → Widget -
Available on Signal<
Create a FormSlot for this signal.T> , provided by the FormSignalExtensions extension -
inc(
[num by = 1]) → void -
Available on Signal<
Short alias for increment. Increments numeric signal byT> , provided by the SignalExtensions extensionby(default 1). -
increment(
[num by = 1]) → void -
Available on Signal<
Increment numeric signal.T> , provided by the SignalExtensions extension -
interpolated(
{required Widget to(BuildContext context, double animatedValue), Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.easeOutCubic}) → Widget -
Available on Signal<
Create an AnimatedValueSlot that interpolates the numeric value.T> , provided by the NumericSignalSlotExtensions extension -
lazy(
{required Widget to(BuildContext context, T value), Widget placeholder(BuildContext context)?}) → Widget -
Available on Signal<
Create a lazy slot that defers building.T> , provided by the SignalSlotExtensions extension -
memoized(
{required Widget to(BuildContext context, T value), bool equals(T a, T b)?}) → Widget -
Available on Signal<
Create a memoized slot with custom equality.T> , provided by the SignalSlotExtensions extension -
Available on Signal<
Create a menu/close icon morph (hamburger menu).bool> , provided by the BooleanMorphExtensions extension -
morph(
{required MorphableWidget morphBuilder(BuildContext context, T value), MorphConfig config = const MorphConfig(), VoidCallback? onMorphStart, VoidCallback? onMorphComplete}) → Widget -
Available on Signal<
Create a MorphSlot for this signal.T> , provided by the MorphSignalExtensions extension -
morphIcon(
{required IconData iconBuilder(T value), double size = 24, Color? color, IconMorphStyle style = IconMorphStyle.crossFade, Duration duration = const Duration(milliseconds: 300)}) → Widget -
Available on Signal<
Create an IconMorphSlot for this signal.T> , provided by the MorphSignalExtensions extension -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Manually notifies all listeners.
inherited
-
onActive(
) → void -
Subscribe to source when first listener is added.
override
-
onInactive(
) → void -
Unsubscribe from source when last listener is removed.
override
-
persist(
SignalPersistence< T> persistence) → PersistentSignal<T> -
Available on Signal<
Create a persistent version of this signal.T> , provided by the SignalHelpers extension -
pipeTo(
Signal< T> target) → StreamSubscription<T> -
Available on Signal<
Pipe values to another signal.T> , provided by the SignalExtensions extension -
playPauseMorph(
{double size = 24, Color? color, IconMorphStyle style = IconMorphStyle.rotateScale}) → Widget -
Available on Signal<
Create a play/pause icon morph.bool> , provided by the BooleanMorphExtensions extension -
pulsing(
{required Widget to(BuildContext context, T value), bool when(T value)?, Duration duration = const Duration(milliseconds: 1000)}) → Widget -
Available on Signal<
Create a pulsing slot for attention.T> , provided by the SignalSlotExtensions extension -
removeListener(
AtomListener listener) → void -
Removes a previously added listener.
inherited
-
reset(
) → void -
Resets the atom to its initial value.
inherited
-
select<
R> (R selector(S value)) → NeuronAtom< R> -
Creates a new atom that selects a part of this atom's value.
inherited
-
select<
S> (S selector(T value)) → SignalSelector< T, S> -
Available on Signal<
Create a selector for granular rebuilds.T> , provided by the SignalHelpers extension -
slot(
Widget builder(BuildContext context, T value)) → Widget -
Available on Signal<
Create a basic Slot widget from this signal.T> , provided by the SignalSlotExtensions extension -
smooth(
{required Widget to(BuildContext context, double animatedValue)}) → Widget -
Available on Signal<
Create a smooth spring animation.T> , provided by the NumericSignalSlotExtensions extension -
snapshot(
) → T -
Available on Signal<
Get current snapshot.T> , provided by the SignalExtensions extension -
spring(
{required Widget to(BuildContext context, double animatedValue), SpringConfig config = const SpringConfig(), double? clampMin, double? clampMax}) → Widget -
Available on Signal<
Create a SpringSlot with physics-based animation.T> , provided by the NumericSignalSlotExtensions extension -
sub(
num amount) → void -
Available on Signal<
SubtractT> , provided by the SignalExtensions extensionamountfrom numeric signal and emit. Alias for decrement. -
subscribe(
VoidCallback listener) → VoidCallback -
Adds a listener and returns a callback that cancels the subscription when called.
inherited
-
tappable(
{required Widget to(BuildContext context, T value), VoidCallback? onTap, VoidCallback? onDoubleTap, VoidCallback? onLongPress, double pressedScale = 0.95}) → Widget -
Available on Signal<
Create a gesture-animated slot.T> , provided by the SignalSlotExtensions extension -
throttle(
Duration duration) → ThrottledSignal< T> -
Available on Signal<
Create a throttled version of this signal.T> , provided by the SignalHelpers extension -
throttled(
{required Widget to(BuildContext context, T value), Duration duration = const Duration(milliseconds: 100)}) → Widget -
Available on Signal<
Create a throttled slot.T> , provided by the SignalSlotExtensions extension -
toggle(
) → void -
Available on Signal<
Toggle boolean signal.T> , provided by the SignalExtensions extension -
toString(
) → String -
A string representation of this object.
inherited
-
transition(
{required Widget to(BuildContext context, T value), SlotTransition type = SlotTransition.fade, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Widget -
Available on Signal<
Create a TransitionSlot with specified transition type.T> , provided by the SignalSlotExtensions extension -
undoable(
{int maxHistory = 50}) → UndoableSignal< T> -
Available on Signal<
Create an undoable version of this signal.T> , provided by the SignalHelpers extension -
visibilityMorph(
{double size = 24, Color? color, IconMorphStyle style = IconMorphStyle.crossFade}) → Widget -
Available on Signal<
Create a visibility toggle icon morph.bool> , provided by the BooleanMorphExtensions extension -
when(
{required bool condition(T value), required Widget to(BuildContext context, T value), Widget orElse(BuildContext context)?}) → Widget -
Available on Signal<
Create a conditional slot with when/orElse.T> , provided by the SignalSlotExtensions extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited