首页 > 解决方案 > Future Builder`构建函数返回null`

问题描述

这是错误消息

To return an empty space that causes the building widget to fill available room, return "Container()". To return an empty space that takes as little room as possible, return "Container(width: 0.0, height: 0.0)".

我设法使用 return 但仍然发生这种情况,这是我发生错误的代码

  FutureBuilder(
   future: _getdetailRM(),
    builder: (context, snapshot) {
    if (snapshot.hasData) {
    return Container();
   }
  }
 )

标签: flutterdart

解决方案


    FutureBuilder(
       future: _getdetailRM(),
        builder: (context, snapshot) {
        if (snapshot.hasData) {
        return Container();
       }else{
    return Container();
    
    }
      }

 )

推荐阅读