Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 在生成方法中使用if-else_Flutter - Fatal编程技术网

Flutter 在生成方法中使用if-else

Flutter 在生成方法中使用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-else构造? 现在我使用double
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
<代码>打印(“这将被打印”)
打印(“这将不被打印”)

是否尝试删除常量?是否尝试删除常量?