当我跑步时:
\n\npod outdated\nRun Code Online (Sandbox Code Playgroud)\n\n在 IOS 上确定是否有任何过时的 pod,我得到以下结果:
\n\n.... \n\nAnalyzing dependencies\nThe color indicates what happens when you run `pod update`\n<green> - Will be updated to the newest version\n<blue> - Will be updated, but not to the newest version because of specified version in Podfile\n<red> - Will not be updated because of specified version in Podfile\n\nThe following pod updates are available:\n- Flutter 1.0.0 -> 1.0.0 (latest version 1.3.300)\n- Protobuf 3.9.2 -> 3.9.2 (latest version 3.10.0-rc1)\nRun Code Online (Sandbox Code Playgroud)\n\n虽然 Flutter 1.0.0 …
我发现的所有将项目插入 Flutter AnimatedList 的示例都利用 GlobalKey.currentState 告诉 AnimatedList 小部件已插入项目。从列表中删除也是一样。
众所周知,在 Flutter 中 GlobalKey 的 currentState 可能为 null。
就我而言,我正在等待 Firebase 消息通过。当出现该消息被插入到 AnimatedList 的 List 数据中时,如果要遵循为 AnimatedList 显示的流行示例,则将使用分配的 GlobalKey.currentState 来告诉 AnimatedList 新项目的插入位置。
但是,就我而言,当我尝试使用它时, GlobalKey.currentState 为空。
否则我还能用什么?我知道我可以使用 setState 但这会导致完整的小部件刷新,在这种情况下,它显示为屏幕上的闪光,而不是所需的漂亮且流畅的 AnimatedList 插入。
许多人都没有使用 InheritedWidget,但如果这是正确的技术,我无法理解在这种情况下它将如何实现。
/////////
// NOTE: This is close to real code, but consider it pseudocode since it is a cut and paste from the real code less quite a bit of extra stuff I have in there. It certainly will not compile but …Run Code Online (Sandbox Code Playgroud) Okay, I am sure this is probably an easy to answer question, but after much searching I can't put my finger on the solution.
How does one in Flutter/Dart create a variable in app XYZ that maintains its' value during the time a user moves away from the app, uses another app, allows the phone to go to sleep, etc., then opens the XYZ app again.
I've created a tiny little app that demonstrates the issue as shown below.
The …