if the home property is specified the routes table cannot include an entry for / if the home property is specified the routes table cannot include an entry for / flutter flutter

if the home property is specified the routes table cannot include an entry for /


The solution is to remove the home property, since it can cause problems if you add the routes property.

class RouteTestApp extends StatelessWidget {  @override  Widget build(BuildContext context) {    return MaterialApp(      title: 'Demo',      initialRoute: '/',      routes: {        '/': (context) => FirstScreen(),        '/second': (context) => SecondScreen(),      },    );  }}


If you set none as '/' code bellow will help you when test widgets with navigation, and still work.

final routes = <String, WidgetBuilder>{  '/one': (BuildContext context) => PageOne(),  '/two': (BuildContext context) => PageTwo(),  ...};runApp(MaterialApp(initialRoute: '/one', routes: appRoutes));