我在Flutter 插件的共享首选项示例中看到了这个操作符。而我没有得到它。
int counter = (prefs.getInt('counter') ?? 0) + 1;
Run Code Online (Sandbox Code Playgroud)
它被称为空感知运算符
意思是,当且仅当prefs.getInt('counter')返回null分配0给它然后加一。
在这里,您可以找到一篇关于空感知运算符的精彩博客文章:http : //blog.sethladd.com/2015/07/null-aware-operators-in-dart.html