提交 8213fd87 编写于 作者: I Ian Hickson

Merge pull request #1971 from Hixie/better-messages-for-MaterialApp

Better asserts for MaterialApp and Navigator
......@@ -36,9 +36,12 @@ class MaterialApp extends StatefulComponent {
Key key,
this.title,
this.theme,
this.routes,
this.routes: const <String, RouteBuilder>{},
this.onGenerateRoute
}) : super(key: key);
}) : super(key: key) {
assert(routes != null);
assert(routes.containsKey(Navigator.defaultRouteName) || onGenerateRoute != null);
}
final String title;
final ThemeData theme;
......
......@@ -23,7 +23,7 @@ abstract class Route {
}
class NamedRouteSettings {
const NamedRouteSettings({ this.name: '<anonymous>', this.mostValuableKeys });
const NamedRouteSettings({ this.name, this.mostValuableKeys });
final String name;
final Set<Key> mostValuableKeys;
......@@ -92,6 +92,7 @@ class NavigatorState extends State<Navigator> {
}
void pushNamed(String name, { Set<Key> mostValuableKeys }) {
assert(name != null);
NamedRouteSettings settings = new NamedRouteSettings(
name: name,
mostValuableKeys: mostValuableKeys
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册