title: Navigator: cannot find a generator/route for pushNamed
body: <p>I am trying to change screens using the value of a string inside a json object but I get the following error in the console and it does not change my screen:</p>
  
  <blockquote>
    <p>Could not find a generator for route RouteSettings ("alert", null) in the _WidgetsAppState.</p>
    
    <p>Generators for routes are searched for in the following order:</p>
    
    <ol>
    <li>For the "/" route, the "home" property, if non-null, is used.</li>
    <li>Otherwise, the "routes" table is used, if it has an entry for the route.</li>
    <li>Otherwise, onGenerateRoute is called. It should return a non-null value for any valid route not handled by "home" and "routes".</li>
    <li>Finally if all else fails onUnknownRoute is called.</li>
    </ol>
    
    <p>Unfortunately, onUnknownRoute was not set.</p>
    
    <p>When the exception was thrown, this was the stack</p>
  </blockquote>
  
  <p>This is my Home Page, the method is working until Navigator.pushNamed(context, opt['ruta']);:</p>
  
  <pre><code> List&lt;Widget&gt; _listItems(List&lt;dynamic&gt; data, BuildContext context) {
  
      final List&lt;Widget&gt; options = [];
  
      data.forEach((opt){
        final widgetTemp = ListTile(
          title: Text(opt['texto']),
          leading: getIcon(opt['icon']),
          trailing: Icon(Icons.keyboard_arrow_right, color: Colors.blue,),
          onTap: (){
            print("Hello");
  
            Navigator.pushNamed(context, opt['ruta']);
  
          },
        );
  
        options..add(widgetTemp)
               ..add(Divider());
      });
  return options;
    }
  </code></pre>
  
  <p>And this is my main.dart where I have the routes:</p>
  
  <pre><code>
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        title: 'Components App',
        debugShowCheckedModeBanner: false,
        initialRoute: '/',
        routes: &lt;String, WidgetBuilder&gt;{
  
            '/' : (BuildContext context) =&gt; HomePage(),
            '/alert' : (BuildContext context) =&gt; AlertPage(),
            '/avatar' : (BuildContext context) =&gt; AvatarPage(),
        },
  
        onGenerateRoute: (settings){
          print("Ruta llamada: ${settings.name }");
        },
      );
    }
  }
  </code></pre>