onCleanup method

void onCleanup(
  1. VoidCallback callback
)

Registers a cleanup function to be called when the watcher is disposed.

Implementation

void onCleanup(VoidCallback callback) {
  _cleanups.add(callback);
}