dispose method

  1. @override
  2. @mustCallSuper
void dispose()

Releases the resources used by this data source.

This should be called when the data source is no longer needed (e.g., in a StatefulWidget's dispose method) to prevent memory leaks by disposing of the underlying ValueNotifier.

Implementation

@override
@mustCallSuper
void dispose() {
  notifier.removeListener(_invalidateCache);
  super.dispose();
}