Dart 检查行';的子项已初始化
在我的颤振应用程序中,我多次出现以下代码:Dart 检查行';的子项已初始化,dart,flutter,Dart,Flutter,在我的颤振应用程序中,我多次出现以下代码: <Widget>[ _isForecastLoaded ? new Center( child: new ForecastView(forecastDayDTOs: _forecast.forecast) ) : new Center(), ... ] [ _船艏楼有货吗 ?新中心( 子级:新建ForecastView(forecastDayDTOs:_forecast.forecast) ) :新
<Widget>[
_isForecastLoaded
? new Center(
child: new ForecastView(forecastDayDTOs: _forecast.forecast)
)
: new Center(),
...
]
[
_船艏楼有货吗
?新中心(
子级:新建ForecastView(forecastDayDTOs:_forecast.forecast)
)
:新中心(),
...
]
这基本上是一个空检查。如果没有它,我会有一个例外,即行不能有空的子行。
我认为这是错误的,但不确定用什么样的方式来处理它 新建ForecastView(forecastDayDTOs:\u forecast.forecast)
<Widget>[
new Center(
child: new ForecastView(forecastDayDTOs: _forecast.forecast)
)
...
]