addListener method Null safety

  1. @override
void addListener(
  1. VoidCallback listener
)
override

Register a closure to be called when the object notifies its listeners.

Implementation

@override
void addListener(VoidCallback listener) {
  if (!hasListeners) {
    WidgetsBinding.instance.addObserver(this);
  }
  super.addListener(listener);
}