Non-nullable by default: how to enable the experiment?

后端 未结 5 1749
礼貌的吻别
礼貌的吻别 2021-01-17 20:53

I just tried the following in DartPad:

void main() {
  int? x;
}

and get the following error:

Error compiling to JavaScript         


        
5条回答
  •  鱼传尺愫
    2021-01-17 21:22

    Add the following line to the analysis_options.yaml

    analyzer:
      enable-experiment:
        - non-nullable
    

提交回复
热议问题