- WidgetsBindingObserver observer
Registers the given object as a binding observer. Binding observers are notified when various application events occur, for example when the system locale changes. Generally, one widget in the widget tree registers itself as a binding observer, and converts the system state into inherited widgets.
For example, the WidgetsApp widget registers as a binding observer and passes the screen size to a MediaQuery widget each time it is built, which enables other widgets to use the MediaQuery.sizeOf static method and (implicitly) the InheritedWidget mechanism to be notified whenever the screen size changes (e.g. whenever the screen rotates).
void addObserver(WidgetsBindingObserver observer) => _observers.add(observer);