相关疑难解决方法(0)

如何修复“无法无条件调用运算符 '{0}',因为接收器可以为 'null'”

在尝试DartSound Null Safety 时,我遇到了一个问题:


一些上下文

创建一个新的Flutter项目我发现以下(并且非常熟悉)片段代码

int _counter = 0;

void _incrementCounter() {
  setState(() {
    // This call to setState tells the Flutter framework that something has
    // changed in this State, which causes it to rerun the build method below
    // so that the display can reflect the updated values. If we changed
    // _counter without calling setState(), then the build method would not be
    // called again, and so nothing would appear …
Run Code Online (Sandbox Code Playgroud)

dart flutter dart-null-safety

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

dart ×1

dart-null-safety ×1

flutter ×1