Could not find a generator for route RouteSettings

Could not find a generator for route RouteSettings("/details", null) in the _WidgetsAppState.

Quick Answer

A named route was pushed that is not defined in the app's route table.

Why This Happens

In Flutter, when you push a named route that is not defined in MaterialApp's routes map or onGenerateRoute, the navigator cannot create the route. Ensure all route names are registered or implement an onUnknownRoute handler.

The Problem

Navigator.pushNamed(context, '/details'); // Not in routes!

MaterialApp(
  routes: {
    '/': (context) => HomePage(),
    // '/details' is missing!
  },
)

The Fix

Navigator.pushNamed(context, '/details');

MaterialApp(
  routes: {
    '/': (context) => HomePage(),
    '/details': (context) => DetailsPage(),
  },
  onUnknownRoute: (settings) => MaterialPageRoute(
    builder: (_) => NotFoundPage(),
  ),
)

Step-by-Step Fix

  1. 1

    Identify the error

    Look at the error about missing route generator. The pushed route name is not registered in the app.

  2. 2

    Find the cause

    Check the routes map in MaterialApp and verify the route name matches exactly, including the leading slash.

  3. 3

    Apply the fix

    Add the missing route to the routes map, or implement onGenerateRoute/onUnknownRoute for dynamic routing.

Bugsly catches this automatically

Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.

Try Bugsly free