title: How to set Firebase Analytics custom events in Flutter without passing 'analytics/observer' object in each screen
body: <p>I'm setting up <a href="https://pub.dev/packages/firebase_analytics" rel="noreferrer">Firebase Analytics Package</a> for my Flutter project. The <a href="https://github.com/flutter/plugins/blob/0b8b6f4df57d56d8b86e3c5adcc5a7606d87f06e/packages/firebase_analytics/example/lib/main.dart#L30" rel="noreferrer">sample</a> provided in the library passes the <code>analytics</code> object for tracking events and <code>observer</code> for tracking the tab changes. </p>
  
  <pre class="lang-dart prettyprint-override"><code>class MyApp extends StatelessWidget {
   ...
  Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Firebase Analytics Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        navigatorObservers: &lt;NavigatorObserver&gt;[observer],
        home: MyHomePage(
          title: 'Firebase Analytics Demo',
          analytics: analytics,
          observer: observer,
        ),
      );
    }
  }
  
  ...
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
  ...
  Future&lt;void&gt; _sendAnalyticsEvent() async {
      await analytics.logEvent(
        name: 'test_event',
        parameters: &lt;String, dynamic&gt;{
          'string': 'string',
          'int': 42,
          'long': 12345678910,
          'double': 42.0,
          'bool': true,
        },
      );
      setMessage('logEvent succeeded');
    }
  ...
  }
  </code></pre>
  
  <p>My app consists of a lot of screens where the state is managed via a <a href="https://felangel.github.io/bloc/" rel="noreferrer">Bloc</a> package. Passing these objects from <code>mainScreen</code> all the way down the tree where the events are happening would not be good. </p>
  
  <p>Is there a way to access them without passing them around the widget tree. Or would it work if I create a new object of the class <code>FirebaseAnalytics</code> and use the generated object to set an event?</p>
  
  <p><code>static FirebaseAnalytics analytics = FirebaseAnalytics();</code>   </p>
  
  <p>Or should I use Flutter_Bloc as a central place to log and set my Flutter Events?</p>