[Solved] flitter Name Route Error: Could not find a generator for route RouteSettings(“XXX”, null) in the _WidgetsAppState

A bug encountered in the configuration of the flutter route: an error is reported: Could not find a generator for route RouteSettings(“XXX”, null) in the _WidgetsAppState.

reason:

Use “/” as the root path when using named routes in the project,
// configure routes
final routes={
‘/’:(context)=>Tabs(),
‘/appBarDemo’:(context)=>AppBarDemoPage(),
‘/tabBarController’:(context)=>TabBarControllerPage()
};

Use home:Tabs() in the root file,

 

Solution:

Change home: tabs() to
onGenerateRoute: onGenerateRoute,
initialRoute: ‘/’,

Read More: