gpt4 book ai didi

dart - 什么意思??在 Dart

转载 作者:行者123 更新时间:2023-12-03 02:53:29 25 4
gpt4 key购买 nike

我在 Example of Shared Preferences 中看到了这个运算符对于 Flutter 插件。我没听懂。

int counter = (prefs.getInt('counter') ?? 0) + 1;

最佳答案

它被称为null-aware operator

意思是,当且仅当 prefs.getInt('counter') 返回 null 时,将 0 分配给它,然后递增 1。

在这里,您可以找到一篇关于 null 感知运算符的精彩博文:http://blog.sethladd.com/2015/07/null-aware-operators-in-dart.html

关于dart - 什么意思??在 Dart ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49801706/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com