Logosolidart

SignalBuilder

A signal widget builder.

Reacts to the signal calling the builder each time. The signal and builder arguments must not be null. The child is optional but is good practice to use if part of the widget subtree does not depend on the value of the signal.

// sample counter
final counter = Signal(0);

@override
void dispose() {
  counter.dispose();
}

@override
Widget build(BuildContext context) {
  return SignalBuilder(
        signal: counter,
        builder: (context, value, child) {
          return Text('$value');
        },
    );
}

If you need to nest multiple SignalBuilders you may also check:

  • DualSignalBuilder to react to 2 signals at once
  • TripleSignalBuilder to react to 3 signals at once.