如何解决这个问题(WillPopScope)

问题描述 投票:0回答:1

enter image description here

基本上我是一个初级程序员,我从来没有见过这样的错误。我总是在做它应该做的事情。拜托,我是程序员世界的新手,我希望有人可以帮助我并教我应该做什么

所以,这是一个 willPopScope 错误,我不知道它在哪里出错,但是,我确实一次又一次地解决了,但它不起作用。有人可以寻找错误吗

我希望。我可以更多地了解我应该学多少课。请给我很多教训来提高自己

flutter dart github google-app-engine
1个回答
0
投票

https://docs.flutter.dev/release/writing-changes/android-predictive-back

据此。 为了支持 Android 14 的 Predictive Back 功能,一组提前 API 取代了即时导航 API,例如 WillPopScope 和 Navigator.willPop。

PopScope 类直接替换了 WillPopScope。

我们之前使用的旧代码:

WillPopScope(
  onWillPop: () async {
    return _anyCondition; //True or False
  },
  child: ...
),

迁移后的代码:

PopScope(
  canPop: _anyCondition,  //Note here it takes a boolean instead of a function
  child: ...
),
© www.soinside.com 2019 - 2024. All rights reserved.