title: Unable to navigate based on auth state in flutter-firebase
body: <p>I am using firebase as a backend service in my android app.I am trying to navigate user to the login screen if it is not logged in.I am checking auth state in <strong>main.dart</strong> file.
  when app launches I am getting something in my logcat window like:</p>
  
  <pre><code>E/FirebaseInstanceId(10239): Failed to resolve target intent service, skipping classname enforcement
  E/FirebaseInstanceId(10239): Error while delivering the message: ServiceIntent not found.
  </code></pre>
  
  <p>Below is my code:</p>
  
  <p><strong>main.dart</strong></p>
  
  <pre><code>import 'package:firebase_auth/firebase_auth.dart';
  import 'package:flutter/material.dart';
  import 'package:google_sign_in/google_sign_in.dart';
  import './home.dart';
  import './orders.dart';
  import './account.dart';
  import './login.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
  
  @override
  Widget build(BuildContext context) {
  return MaterialApp(
    home: MyTabs(),
    debugShowCheckedModeBanner: false,
    routes: &lt;String,WidgetBuilder&gt;{
      '/login':(BuildContext context) =&gt; Login()
    },
    theme: ThemeData(
      primaryColor: Colors.white,
      primaryColorDark: Colors.grey,
      accentColor: Colors.green
     ),
    );
   }
  }
  
  class MyTabs extends StatefulWidget {
  
  @override
  _MyTabsState createState() =&gt; _MyTabsState();
  }
  
  
  class _MyTabsState extends State&lt;MyTabs&gt; {
  
  FirebaseAuth auth = FirebaseAuth.instance;
  
  int selectedIndex = 0;
  final pages = [Home(),Orders(),Account()];
  
  void choosePage(int index){
  
  setState(() {
  
      selectedIndex = index;
    });
  }
  
  @override
  void initState() {
  super.initState();
  
    if(auth.currentUser() == null){
  
       Navigator.of(context).pushReplacementNamed("/login");
    }
  }
  
   @override
   Widget build(BuildContext context) {
   return Scaffold(
       appBar: AppBar(
         title: Text("Tiffino")
       ),
       body: pages[selectedIndex],
       bottomNavigationBar: BottomNavigationBar(
        currentIndex: selectedIndex,
        fixedColor: Colors.black,
        onTap: choosePage,
        items: [
          BottomNavigationBarItem(
             icon: Icon(Icons.home),
             title: Text("Home")
          ),
          BottomNavigationBarItem(
             icon: Icon(Icons.list),
             title: Text("Orders")
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person),
            title: Text("Account")
           )
          ]
        )      
      );
    }
  }
  </code></pre>
  
  <p>Someone please correct me if I did anything wrong in above code.</p>
  
  <p><strong>THANKS</strong></p>