MultiSlot class
============================================================================ MULTI SLOT - UNIFIED MULTI-SIGNAL WIDGET
A widget that rebuilds when any of multiple signals change.
MultiSlot provides a clean, efficient way to subscribe to multiple signals without deeply nested builders. It uses a single subscription per signal and rebuilds once when any signal changes.
Type-Safe Factory Constructors
Use the numbered factory constructors for compile-time type safety:
// Two signals
MultiSlot.t2(
connect: (nameSignal, ageSignal),
to: (context, name, age) => Text('$name is $age'),
)
// Three signals
MultiSlot.t3(
connect: (a, b, c),
to: (context, v1, v2, v3) => Text('$v1 $v2 $v3'),
)
Dynamic List of Signals
For a variable number of signals (loses type safety):
MultiSlot.list(
connect: [signal1, signal2, signal3],
to: (context, values) => Text(values.join(', ')),
)
Comparison with Nested Slots
Instead of:
Slot(
connect: signal1,
to: (ctx, v1) => Slot(
connect: signal2,
to: (ctx, v2) => Slot(
connect: signal3,
to: (ctx, v3) => MyWidget(v1, v2, v3),
),
),
)
Use:
MultiSlot.t3(
connect: (signal1, signal2, signal3),
to: (ctx, v1, v2, v3) => MyWidget(v1, v2, v3),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MultiSlot
- Available extensions
Properties
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MultiSlot> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
VoidCallback onTap, {double pressedScale = 0.95}) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Wrap with tap gesture. -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → 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
-
withDelay(
Duration delay) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Add a delay before showing. -
withFade(
{Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Wrap with fade animation on appear. -
withHero(
Object tag) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Wrap with hero animation. -
withScale(
{double begin = 0.8, double end = 1.0, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeOutBack}) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Wrap with scale animation on appear. -
withShimmer(
{Duration duration = const Duration(milliseconds: 1500), Color baseColor = const Color(0xFFE0E0E0), Color highlightColor = const Color(0xFFF5F5F5)}) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Apply a shimmer loading effect. -
withSlide(
{Offset begin = const Offset(0, 0.2), Offset end = Offset.zero, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeOutCubic}) → Widget -
Available on Widget, provided by the SlotWidgetModifiers extension
Wrap with slide animation on appear.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
list(
{Key? key, required List< NeuronAtom> connect, required Widget to(BuildContext context, List values)}) → Widget - Creates a MultiSlot for a dynamic list of signals.
-
t2<
T1, T2> ({Key? key, required (NeuronAtom< T1> , NeuronAtom<T2> ) connect, required Widget to(BuildContext context, T1 v1, T2 v2)}) → Widget - Creates a MultiSlot for two signals with type-safe builder.
-
t3<
T1, T2, T3> ({Key? key, required (NeuronAtom< T1> , NeuronAtom<T2> , NeuronAtom<T3> ) connect, required Widget to(BuildContext context, T1 v1, T2 v2, T3 v3)}) → Widget - Creates a MultiSlot for three signals with type-safe builder.
-
t4<
T1, T2, T3, T4> ({Key? key, required (NeuronAtom< T1> , NeuronAtom<T2> , NeuronAtom<T3> , NeuronAtom<T4> ) connect, required Widget to(BuildContext context, T1 v1, T2 v2, T3 v3, T4 v4)}) → Widget - Creates a MultiSlot for four signals with type-safe builder.
-
t5<
T1, T2, T3, T4, T5> ({Key? key, required (NeuronAtom< T1> , NeuronAtom<T2> , NeuronAtom<T3> , NeuronAtom<T4> , NeuronAtom<T5> ) connect, required Widget to(BuildContext context, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5)}) → Widget - Creates a MultiSlot for five signals with type-safe builder.
-
t6<
T1, T2, T3, T4, T5, T6> ({Key? key, required (NeuronAtom< T1> , NeuronAtom<T2> , NeuronAtom<T3> , NeuronAtom<T4> , NeuronAtom<T5> , NeuronAtom<T6> ) connect, required Widget to(BuildContext context, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6)}) → Widget - Creates a MultiSlot for six signals with type-safe builder.