【发布时间】:2021-10-28 11:58:11
【问题描述】:
这里是代码
ListTile(
leading: Icon(Icons.person),
title: Text(
("My Account"),
),
onTap: () {
Navigator.of(context).pushNamed(profilePage);
},
),
这是路由文件
const String loginPage = 'loginScreen';
const String homePage = 'main';
const String profilePage = 'profileScreen';
Route<dynamic> controller(RouteSettings settings) {
switch (settings.name) {
case loginPage:
return MaterialPageRoute(builder: (context) => LoginScreen());
case homePage:
return MaterialPageRoute(builder: (context) => App());
case profilePage:
return MaterialPageRoute(builder: (context) => Profile());
default:
throw ('This route does not exist');
}
这是错误:
════════手势捕获的异常═════════════════════════════␕═══ ════════ 'package:flutter/src/widgets/navigator.dart':断言失败:第 4134 行 pos 12:'!_debugLocked':不正确。 ══════════════════════════════════════════>
【问题讨论】:
-
我确定您有更多错误消息,但请检查:stackoverflow.com/questions/55618717/…
-
你能提供你的 main.dart 代码吗?
-
docs.google.com/document/d/… 我在word文件中粘贴了“main.dart”。请检查它。
标签: flutter