title: Flutter: possible to detect when a drawer is open?
body: <p>Is it possible to detect when a Drawer is open so that we can run some routine to update its content?</p>
  
  <p>A typical use case I have would be to display the number of followers, likers... and for this, I would need to poll the server to get this information, then to display it.</p>
  
  <p>I tried to implement a NavigatorObserver to catch the moment when the Drawer is made visible/hidden but the NavigatorObserver does not detect anything about the Drawer.</p>
  
  <p>Here is the code linked to the NavigatorObserver:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  typedef void OnObservation(Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute);
  typedef void OnStartGesture();
  
  class NavigationObserver extends NavigatorObserver {
    OnObservation onPushed;
    OnObservation onPopped;
    OnObservation onRemoved;
    OnObservation onReplaced;
    OnStartGesture onStartGesture;
  
    @override
    void didPush(Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
      if (onPushed != null) {
        onPushed(route, previousRoute);
      }
    }
  
    @override
    void didPop(Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
      if (onPopped != null) {
        onPopped(route, previousRoute);
      }
    }
  
    @override
    void didRemove(Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
      if (onRemoved != null)
        onRemoved(route, previousRoute);
    }
  
    @override
    void didReplace({ Route&lt;dynamic&gt; oldRoute, Route&lt;dynamic&gt; newRoute }) {
      if (onReplaced != null)
        onReplaced(newRoute, oldRoute);
    }
  
    @override
    void didStartUserGesture() { 
      if (onStartGesture != null){
        onStartGesture();
      }
    }
  }
  </code></pre>
  
  <p>and the initialization of this observer</p>
  
  <pre><code>void main(){
    runApp(new MyApp());
  }
  
  class MyApp extends StatefulWidget {
    @override
    _MyAppState createState() =&gt; new _MyAppState();
  }
  
  class _MyAppState extends State&lt;MyApp&gt; {
    final NavigationObserver _observer = new NavigationObserver()
                                                ..onPushed = (Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
                                                  print('** pushed route: $route');
                                                }
                                                ..onPopped = (Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
                                                  print('** poped route: $route');
                                                }
                                                ..onReplaced = (Route&lt;dynamic&gt; route, Route&lt;dynamic&gt; previousRoute) {
                                                  print('** replaced route: $route');
                                                }
                                                ..onStartGesture = () {
                                                  print('** on start gesture');
                                                };
  
    @override
    void initState(){
      super.initState();
    }
  
    // This widget is the root of your application.
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        title: 'Title',
        theme: new ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: new SplashScreen(),
          routes: &lt;String, WidgetBuilder&gt; {
            '/splashscreen': (BuildContext context) =&gt; new SplashScreen(),
          },
          navigatorObservers: &lt;NavigationObserver&gt;[_observer],
      );
    }
  }
  </code></pre>
  
  <p>Thanks for your help.</p>