observe method

Widget observe(
  1. Widget build()
)

Rebuilds the widget whenever the values of the cells referenced in build change.

The function build is called and the value returned by it is returned from this method. build may reference the values of ValueCell's using ValueCell.call. Further changes to the values of the referenced cells trigger a rebuild of the widget corresponding to this State, as if by setState.

Implementation

Widget observe(Widget Function() build) {
  return ComputeArgumentsTracker.computeWithTracker(build, (cell) {
    if (!_arguments.contains(cell)) {
      _arguments.add(cell);
      cell.addObserver(_observer);
    }
  });
}