[英]Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3499 pos 12: '!_debugLocked': is not true." FLUTTER
I work in flutter project, and i have a problem that : the project composed from three Pages (splash.dart, login.dart, dashboard.dart), when the app launch the splash.dart page opened, and i passe the new user to login.dart page, and when he put a valid credentials i passe he to dashboard.dart page but in this second passage i got the error below "[ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 3499 pos 12: '!_debugLocked': is not true."我在flutter项目中工作,我有一个问题:该项目由三个页面(splash.dart、login.dart、dashboard.dart)组成,当应用程序启动splash.dart页面时,我通过了新用户到 login.dart 页面,当他输入有效凭据时,我将他传递给了dashboard.dart 页面,但在第二段中,我收到以下错误“[ERROR:flutter/lib/ui/ui_dart_state.cc(166)] 未处理的异常:'package:flutter/src/widgets/navigator.dart':断言失败:第 3499 行 pos 12:'!_debugLocked':不正确。” Also when i want to display an alert to inform the user to put a valid credentials when he put invalid credentials a got the same problem thanks in advance,此外,当我想显示警报以通知用户输入无效凭据时,他会遇到同样的问题,请提前感谢,
The method you use for page redirection should look like this:您用于页面重定向的方法应如下所示:
Navigator.of(context).push(
MaterialPageRoute(
settings: RouteSettings(name: OtherPage.routeName),
builder: (context) => OtherPage(),
),
);
If this method doesn't fix your problem, be careful where you define it in the builder widget and make sure you don't use BuildContext in unnecessary places如果此方法不能解决您的问题,请注意在构建器小部件中定义它的位置,并确保不要在不必要的地方使用BuildContext
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.