获取导航无法正常运行
我尝试使用声音空的安全性构建扑动项目,并且使用了: ^4.6.1。以前,在没有启用无效安全性的情况下,使用GET的导航工作正常,但是现在,导航无法正常运行。最初,我有错误 抛出了另一个例外:'软件包/flutter/src/widgets/navigator.dart':失败断言:第4028 line 4028 pos 12:'!_debuglocked':是不正确的。 通过使用AddPostFrameCallback解决。但是,每当我尝试通过点击“查看全部”来导航到新屏幕时,打印语句就会执行,但是除非我在屏幕上的其他地方点击或拖动其他地方,否则它不会导航到新屏幕。
GestureDetector(
onTap: () {
print("tapped");
WidgetsBinding.instance.addPostFrameCallback(
(_) => Get.toNamed(AllProductsScreen.route));
},
child: const Text(
"See All",
style: kHeaderTextStyle,
),
)
I tried building flutter project with sound null safety and I am using get: ^4.6.1. Previously, without enabling null safety, navigation using Get was working fine, but now, navigation is not functioning properly. Initially, I got error
Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 4028 pos 12: '!_debugLocked': is not true.
which was resolved by using addPostFrameCallback. However, Whenever I try to navigate to new screen by tapping "See All", print statement gets executed, but it won't navigate to new screen unless I tap or drag somewhere else in screen.
GestureDetector(
onTap: () {
print("tapped");
WidgetsBinding.instance.addPostFrameCallback(
(_) => Get.toNamed(AllProductsScreen.route));
},
child: const Text(
"See All",
style: kHeaderTextStyle,
),
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论