问答详情
源自:3-5 条件表达式

String c = a ?? b;

Warning: Operand of null-aware operation '??' has type 'String' which excludes null.

chapter3/operator_conditional.dart:17

 String c = a ?? b;


 我这里使用这String c = a?? b;  出现了警告,这是为什么啊?!

提问者:丛从绿草 2021-11-24 16:04

个回答

  • weixin_慕码人0066820
    2022-12-09 14:10:05

    String 类型改成  dynamic 动态的


  • weixin_慕丝9160112
    2022-09-11 15:21:05

    var b;

  • weixin_慕丝9160112
    2022-09-11 15:17:59

    b;
    b ??= ;


  • 慕UI6158054
    2021-11-30 15:51:36

    int a=5;
    a ??= 10;
    print(a);

    Warning: Operand of null-aware operation '??=' has type 'int' which excludes null.

      a ??= 10;

    一样报错