Logosolidart

SignalBuilder API docs

Reacts to the signal calling the builder each time.

final counter = Signal(0);

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

Constructor#

SignalBuilder({
  required SignalBase<T> signal,
  required ValueWidgetBuilder<T> builder,
  Widget? child,
});

signal The signal whose value you depend on in order to build. This widget does not ensure that the signal's value is not null, therefore your builder may need to handle null values.

builder is the function that builds the widget with the current value of the signal.

child is optional and can be null if the entire widget subtree the builder builds depends on the value of the signal. This widget will be passed to the builder and DOESN'T rebuilds if the value of the signal changes.

See also __DualSignalBuilder__and TripleSignalBuilder to react to multiple signals