title: Error:-Could not find a generator for route RouteSettings("", null) in the _WidgetsAppState
body: <p>I am building a flash Chat app where you can chat with the computer.I am still in the UI stage.I tried to refactor all my code into a widget with OnPressed,Title,Color properties.I ahve made a Login Screen,RegisterationScreen and a welcome Screen.My app is running fine but I am getting the following error</p>
  <pre><code>Error: Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/navigation/history.dart:239:12
  _isOriginEntry(state)
  is not true
      at Object.throw_ [as throw] (http://localhost:64778/dart_sdk.js:5348:11)
      at Object.assertFailed (http://localhost:64778/dart_sdk.js:5284:15)
      at _engine.SingleEntryBrowserHistory.new.[_unwrapOriginState] (http://localhost:64778/dart_sdk.js:149781:57)
      at _engine.SingleEntryBrowserHistory.new.tearDown (http://localhost:64778/dart_sdk.js:149841:79)
      at tearDown.next (&lt;anonymous&gt;)
      at http://localhost:64778/dart_sdk.js:39230:33
      at _RootZone.runUnary (http://localhost:64778/dart_sdk.js:39087:58)
      at _FutureListener.thenAwait.handleValue (http://localhost:64778/dart_sdk.js:34073:29)
      at handleValueCallback (http://localhost:64778/dart_sdk.js:34633:49)
      at Function._propagateToListeners (http://localhost:64778/dart_sdk.js:34671:17)
      at _Future.new.[_completeWithValue] (http://localhost:64778/dart_sdk.js:34513:23)
      at async._AsyncCallbackEntry.new.callback (http://localhost:64778/dart_sdk.js:34536:35)
      at Object._microtaskLoop (http://localhost:64778/dart_sdk.js:39374:13)
      at _startMicrotaskLoop (http://localhost:64778/dart_sdk.js:39380:13)
      at http://localhost:64778/dart_sdk.js:34887:9
  
  ======== Exception caught by gesture ===============================================================
  The following assertion was thrown while handling a gesture:
  Could not find a generator for route RouteSettings(&quot;&quot;, null) in the _WidgetsAppState.
  
  Make sure your root app widget has provided a way to generate 
  this route.
  Generators for routes are searched for in the following order:
   1. For the &quot;/&quot; route, the &quot;home&quot; property, if non-null, is used.
   2. Otherwise, the &quot;routes&quot; table is used, if it has an entry for the route.
   3. Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not handled by &quot;home&quot; and &quot;routes&quot;.
   4. Finally if all else fails onUnknownRoute is called.
  Unfortunately, onUnknownRoute was not set.
  When the exception was thrown, this was the stack: 
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49  throw_
  packages/flutter/src/widgets/app.dart 1228:9                                                                               &lt;fn&gt;
  packages/flutter/src/widgets/app.dart 1242:14                                                                              [_onUnknownRoute]
  packages/flutter/src/widgets/navigator.dart 4170:22                                                                        [_routeNamed]
  packages/flutter/src/widgets/navigator.dart 4212:20                                                                        pushNamed
  ...
  Handler: &quot;onTap&quot;
  Recognizer: TapGestureRecognizer#99535
    debugOwner: GestureDetector
    state: possible
    won arena
    finalPosition: Offset(525.0, 491.0)
    finalLocalPosition: Offset(501.0, 10.0)
    button: 1
    sent tap down
  ====================================================================================================
  
  ======== Exception caught by gesture ===============================================================
  The following assertion was thrown while handling a gesture:
  Could not find a generator for route RouteSettings(&quot;&quot;, null) in the _WidgetsAppState.
  
  Make sure your root app widget has provided a way to generate 
  this route.
  Generators for routes are searched for in the following order:
   1. For the &quot;/&quot; route, the &quot;home&quot; property, if non-null, is used.
   2. Otherwise, the &quot;routes&quot; table is used, if it has an entry for the route.
   3. Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not handled by &quot;home&quot; and &quot;routes&quot;.
   4. Finally if all else fails onUnknownRoute is called.
  Unfortunately, onUnknownRoute was not set.
  When the exception was thrown, this was the stack: 
  C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49  throw_
  packages/flutter/src/widgets/app.dart 1228:9                                                                               &lt;fn&gt;
  packages/flutter/src/widgets/app.dart 1242:14                                                                              [_onUnknownRoute]
  packages/flutter/src/widgets/navigator.dart 4170:22                                                                        [_routeNamed]
  packages/flutter/src/widgets/navigator.dart 4212:20                                                                        pushNamed
  ...
  Handler: &quot;onTap&quot;
  Recognizer: TapGestureRecognizer#99535
    debugOwner: GestureDetector
    state: possible
    won arena
    finalPosition: Offset(386.0, 487.0)
    finalLocalPosition: Offset(362.0, 6.0)
    button: 1
    sent tap down
  ====================================================================================================
  Error: Assertion failed: org-dartlang-sdk:///flutter_web_sdk/lib/_engine/engine/navigation/history.dart:284:14
  _userProvidedRouteName != null
  is not true
      at Object.throw_ [as throw] (http://localhost:64778/dart_sdk.js:5348:11)
      at Object.assertFailed (http://localhost:64778/dart_sdk.js:5284:15)
      at _engine.SingleEntryBrowserHistory.new.onPopState (http://localhost:64778/dart_sdk.js:149805:59)
  </code></pre>
  <p>Here is my code:-</p>
  <p>Main.dart</p>
  <pre><code>import 'dart:html';
  
  import 'package:flutter/material.dart';
  import 'package:flash_chat/screens/welcome_screen.dart';
  import 'package:flash_chat/screens/login_screen.dart';
  import 'package:flash_chat/screens/registration_screen.dart';
  import 'package:flash_chat/screens/chat_screen.dart';
  import 'package:flash_chat/screens/chat_screen.dart';
  import 'package:flash_chat/screens/login_screen.dart';
  import 'screens/registration_screen.dart';
  import 'screens/welcome_screen.dart';
  void main() =&gt; runApp(FlashChat());
  
  class FlashChat extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        initialRoute: WelcomeScreen.id,
        routes:{
         ChatScreen.id :(context)=&gt;ChatScreen(),
          LoginScreen.id:(context)=&gt;LoginScreen(),
          RegistrationScreen.id:(context)=&gt;RegistrationScreen(),
          WelcomeScreen.id:(context)=&gt;WelcomeScreen(),//if we use string chances of spelling mistakes soo just type that and save it as a string in the welcome Screen and access it
        },//We have changed id to static string so we no longer need to call WelcomeScreen()
        theme: ThemeData.dark().copyWith(
          textTheme: TextTheme(
            body1: TextStyle(color: Colors.black54),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Welcome_Screen.dart</p>
  <pre><code>import 'package:animated_text_kit/animated_text_kit.dart';
  import 'package:flash_chat/screens/login_screen.dart';
  import 'package:flash_chat/screens/registration_screen.dart';
  import 'package:flutter/material.dart';
  class WelcomeScreen extends StatefulWidget {
   static String id = 'Welcome_Screen';
    @override
    _WelcomeScreenState createState() =&gt; _WelcomeScreenState();
  }
  
  class _WelcomeScreenState extends State&lt;WelcomeScreen&gt;  with SingleTickerProviderStateMixin {
    //SingleTickerProviderStateMixin allows the class to becomes a ticker
     late AnimationController controller;
     late Animation animation;
  
    void initState() {
      super.initState();
      controller = AnimationController(
        duration: Duration(seconds: 1,),
        //duration of animation is 1 sec
        upperBound: 1.0,
        //This upperBound tells the size of the flash button to which it must animate from 0 to 10 or 0 to 100 or 0 to 1000(overflows cant fit in the screen)
        vsync: this, //this is to mention that this class is going to provide the ticker
      );
  
      controller.forward(); //to take the animation forward
  
      controller.addListener(() { //to see what the controller class is doing we need to add controller.addListner
        setState(() { //without putting set state u cant see the animation happening
        });
      });
    }
  
    @override
    void dispose() {
      controller.dispose();
      super.dispose();
    }
  
    Widget build(BuildContext context) {
      return Scaffold(
          backgroundColor: Colors.white,
          // backgroundColor: Colors.red.withOpacity(controller.value),//pass the animaton controller values that is changing from 0 to 1 slowly as animation proceeds to this so that the color slowly changes from white to dark red
          body: Padding(
            padding: EdgeInsets.symmetric(horizontal: 24.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: &lt;Widget&gt;[
            Row(
            children: &lt;Widget&gt;[
              Hero(
              tag:'logo',
              child: Container
                (
                child: Image.asset('images/logo.png'),
                height: 60, //animation.value*100,
              ),
            ),
            TypewriterAnimatedTextKit(
              speed: Duration(
                  milliseconds: 200
              ),
              text: ['Flash Chat'],
              textStyle: TextStyle(
                fontSize: 45.0,
                fontWeight: FontWeight.w900,
              ),
            ),
            ],
          ),
          SizedBox(
            height: 48.0,
          ),
          RoundedButton(
            onPressed:() {
            Navigator.pushNamed(context,LoginScreen.id);//Go to login screen.
          },
            title: 'Log In',
            colour:  Colors.lightBlueAccent,
          ),
                RoundedButton(
                  onPressed:() {
                    Navigator.pushNamed(context,RegistrationScreen.id);//Go to login screen.
                  },
                  title: 'Register',
                  colour: Colors.blueAccent,
                ),
      ],
      ),
      ),
      );
    }
  }
  
  class RoundedButton extends StatelessWidget {
    RoundedButton({required this.onPressed,required this.colour,required this.title});
  
  final Color colour;
  final String title;
  final Function onPressed;
    @override
    Widget build(BuildContext context) {
      return Padding(
        padding: EdgeInsets.symmetric(vertical: 16.0),
        child: Material(
          elevation: 5.0,
          color: colour,
          borderRadius: BorderRadius.circular(30.0),
          child: MaterialButton(
            onPressed:(){
              onPressed();
            },
            minWidth: 200.0,
            height: 42.0,
            child: Text(
              title,
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Registeration_Screen.dart</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class RegistrationScreen extends StatefulWidget {
    static String id= 'Registration_Screen';
    @override
    _RegistrationScreenState createState() =&gt; _RegistrationScreenState();
  }
  
  class _RegistrationScreenState extends State&lt;RegistrationScreen&gt; with SingleTickerProviderStateMixin {//if only one animation  use singleTickerProviderMixer
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: Colors.white,
        body: Padding(
          padding: EdgeInsets.symmetric(horizontal: 24.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: &lt;Widget&gt;[
              Hero(
                tag: 'logo',
                child: Container(
                  height: 200.0,
                  child: Image.asset('images/logo.png'),
                ),
              ),
              SizedBox(
                height: 48.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration: InputDecoration(
                  hintText: 'Enter your email',
                  contentPadding:
                      EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueAccent, width: 1.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueAccent, width: 2.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                ),
              ),
              SizedBox(
                height: 8.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration: InputDecoration(
                  hintText: 'Enter your password',
                  contentPadding:
                      EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  enabledBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueAccent, width: 1.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.blueAccent, width: 2.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                ),
              ),
              SizedBox(
                height: 24.0,
              ),
              Padding(
                padding: EdgeInsets.symmetric(vertical: 16.0),
                child: Material(
                  color: Colors.blueAccent,
                  borderRadius: BorderRadius.all(Radius.circular(30.0)),
                  elevation: 5.0,
                  child: MaterialButton(
                    onPressed: () {
                      //Implement registration functionality.
                    },
                    minWidth: 200.0,
                    height: 42.0,
                    child: Text(
                      'Register',
                      style: TextStyle(color: Colors.white),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>Login_Screen.dart</p>
  <pre><code>import 'package:flutter/material.dart';
  
  class LoginScreen extends StatefulWidget {
    static String id = 'Login_Screen';
    @override
    _LoginScreenState createState() =&gt; _LoginScreenState();
  }
  
  class _LoginScreenState extends State&lt;LoginScreen&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        backgroundColor: Colors.white,
        body: Padding(
          padding: EdgeInsets.symmetric(horizontal: 24.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: &lt;Widget&gt;[
              Hero(
                tag: 'logo',
                child: Container(
                  height: 200.0,
                  child: Image.asset('images/logo.png'),
                ),
              ),
              SizedBox(
                height: 48.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration: InputDecoration(
                  hintText: 'Enter your email',
                  contentPadding:
                      EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  enabledBorder: OutlineInputBorder(
                    borderSide:
                        BorderSide(color: Colors.lightBlueAccent, width: 1.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide:
                        BorderSide(color: Colors.lightBlueAccent, width: 2.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                ),
              ),
              SizedBox(
                height: 8.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration: InputDecoration(
                  hintText: 'Enter your password.',
                  contentPadding:
                      EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  enabledBorder: OutlineInputBorder(
                    borderSide:
                        BorderSide(color: Colors.lightBlueAccent, width: 1.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                  focusedBorder: OutlineInputBorder(
                    borderSide:
                        BorderSide(color: Colors.lightBlueAccent, width: 2.0),
                    borderRadius: BorderRadius.all(Radius.circular(32.0)),
                  ),
                ),
              ),
              SizedBox(
                height: 24.0,
              ),
              Padding(
                padding: EdgeInsets.symmetric(vertical: 16.0),
                child: Material(
                  color: Colors.lightBlueAccent,
                  borderRadius: BorderRadius.all(Radius.circular(30.0)),
                  elevation: 5.0,
                  child: MaterialButton(
                    onPressed: () {
                      Navigator.pushNamed(context, '');
                      //Implement login functionality.
                    },
                    minWidth: 200.0,
                    height: 42.0,
                    child: Text(
                      'Log In',
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      );
    }
  }
  </code></pre>