代码语言:javascript复制
void main() {
bool flag = true;
var val = flag ? 'true' : 'false';
print(val); //val为true
int count;
count ??= 20; //count为空赋值为20
print(count);//count为20
int a;
int b = a ?? 30; //a为空赋值为30
print(b);//b为30
}