错误描述:
已有的页面跳转正常,添加一个新页面后,新页面跳转出现如下错误
Generators for routes are searched for in the following order:
1. For the "/" route, the "home" property, if non-null, is used.
2. Otherwise, the "routes" 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 "home" and "routes".
4. Finally if all else fails onUnknownRoute is called.
Unfortunately, onUnknownRoute was not set.
#0 _WidgetsAppState._onUnknownRoute.<anonymous closure> (package:flutter/src/widgets/app.dart:1175:9)
#1 _WidgetsAppState._onUnknownRoute (package:flutter/src/widgets/app.dart:1190:6)
#2 NavigatorState._routeNamed (package:flutter/src/widgets/navigator.dart:3388:36)
#3 NavigatorState.pushNamed (package:flutter/src/widgets/n<…>
可能的问题是:
入口已经设置过routes
新页面多包裹了一层MaterialApp并设置了home导致之前设置的routes失效了。