I have an async function inside of a stateful widget. Under the BuildContext, I have this function,
getChildren() async {
final String numberOfChildren = await FirebaseFirestore.instance
.collection("children")
.where("parentUID", isEqualTo: uid)
.snapshots()
.length
.toString();
}
How do I use the the numberOfChildren variable inside of a Text widget.
Text(
'Children: $numberOfChildren',
style: TextStyle(
fontSize: 22,
color: Color(0xff74828E),
fontFamily: 'Rubik',
fontWeight: FontWeight.w900,
),
),
But it says that numberOfChild
How can I use this in a text widget?
