我只是在学习flutter,我正在寻找问题。我不能从firebase中检索数据,以前我可以用相同的代码检索数据,但现在我不能。我发现我发现如下所列的错误。这是怎么发生的呢?在那之前就不是了。我希望有人能帮助我
这是我的代码
``` StreamBuilder(
stream: dbRef.child("Data").onValue,
builder: (context, snapshot) {
if (snapshot.hasData &&
!snapshot.hasError &&
snapshot.data.snapshot.value != null) {
return Column(
children: <Widget>[
Container(
height: size.height * 1,
child: Stack(
children: <Widget>[
Positioned(
height: 40,
bottom: 520,
left: 0,
right: 0,
child: Container(
margin: EdgeInsets.symmetric(
horizontal: kDefaultPadding),
padding: EdgeInsets.symmetric(
horizontal: kDefaultPadding),
height: 10,
decoration: BoxDecoration(
color: Colors.cyan,
borderRadius: BorderRadius.circular(15),
boxShadow: [
BoxShadow(
offset: Offset(0, 10),
blurRadius: 50,
color: kPrimaryColor.withOpacity(0.5),
),
],
),
child: Center(
child: Text("PLANT MOISTURE CONTROLLER",
style: TextStyle(fontSize: 18)),
),
)),],))],)}}) ```
这是错误:
发布于 2021-01-24 03:40:28
加载数据时,您需要返回一些小部件,例如:
StreamBuilder(
stream: dbRef.child("Data").onValue,
builder: (context, snapshot) {
if (!snapshot.hasData)
return Center(child: CircularProgressIndicator());
return Container(child: Text('real content'));
});
https://stackoverflow.com/questions/65861202
复制相似问题