onDispose function

void onDispose(
  1. void dispose()
)

To dispose anything when the widget is disposed you can use call onDispose anywhere in your build function.

Implementation

void onDispose(void Function() dispose) {
  assert(_activeWatchItState != null,
      'onDispose can only be called inside a build function within a WatchingWidget or a widget using the WatchItMixin');
  _activeWatchItState!.onDispose(dispose);
}