$watch function

  1. @Deprecated('Use KaeruWidget instead. This will be removed in a future version.')
VoidCallback $watch(
  1. Iterable<Listenable?> source,
  2. VoidCallback callback, {
  3. bool immediate = false,
})

Sets up a watcher on the given source and triggers the callback when any of the Listenable objects in the source change. If immediate is true, the callback is triggered immediately after setting up the listener.

Returns a VoidCallback that can be used to remove the listener when it's no longer needed.

The watch instance is automatically disposed when the widget is disposed.

Note: This is part of the deprecated defineWidget API.

Implementation

@Deprecated('Use KaeruWidget instead. This will be removed in a future version.')
VoidCallback $watch(Iterable<Listenable?> source, VoidCallback callback,
        {bool immediate = false}) =>
    autoContextDisposeFn(watch$(source, callback, immediate: immediate));