- 命名路由问题
注册路由:
code1: routes: {
"new_route":(context) => NewRoute()
}
启动路由:
code2: Navigator.pushNamed(context, "new_route");
抛出异常:
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: type 'MaterialPageRoute<dynamic>' is not a subtype of type 'Route<String>'
解决问题:
code2修改为:Navigator.pushNamed<dynamic>(context, "new_route");