Flutter 在生成方法中使用if-else
如何在构建方法中使用if-else构造? 现在我使用doubleFlutter 在生成方法中使用if-else,flutter,Flutter,如何在构建方法中使用if-else构造? 现在我使用doubleif: if (_rapport.isNotEmpty && _rapport.length == 3) Container( child: Text(_rapport), ), if (_rapport.isEmpty || _rapport.length != 3) const Text('wrong input'), 使用else时会出现以下错误: 您可以使用三元if语句。 条件真:假 结
if
:
if (_rapport.isNotEmpty && _rapport.length == 3)
Container(
child: Text(_rapport),
),
if (_rapport.isEmpty || _rapport.length != 3)
const Text('wrong input'),
使用else
时会出现以下错误:
您可以使用三元if语句。
条件
<代码>真:假代码>
结合上下文:
5>1
<代码>打印(“这将被打印”)
:打印(“这将不被打印”)代码>
?您可以使用三元if语句。
条件
<代码>真
:假代码>
结合上下文:
5>1
<代码>打印(“这将被打印”)
:打印(“这将不被打印”)代码>
?是否尝试删除常量?是否尝试删除常量?