I have tried to get the value of an int type from my database but it returns a null value i used a future to prevent that but still same problem it returns null
I tried calling the method inside the build function and also outside the build even went a step further to call it inside initState but no success whats the problem?
Widget build(BuildContext context){...}
int getSnapShotDataAsInt(String child){
FutureBuilder(
future: databaseReference
.child("users")
.child(_firebaseUser.uid)
.child(child)
.once(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData && snapshot.data != null) {
return snapshot.data.value;
} else {
return CircularProgressIndicator();
}
}
);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…