enter image description here

How can I access the "actual" data field from the 0th index (just 0th index not other indexes) of data['seniornotice'] in cloud firestore database using flutter? Please see the image below

Thank you in advance


Solution 1: Josteve

Check this out.

Future<String> getActual() async {
 var data = await FirebaseFirestore.instance.collection("seniornotice").doc("0YLOLYXxp2xFVFm4GuAt").get();
 return data["actual"];
}

Edit

To assign the value, try this.

String a;
void assign() async{
  a = await getActual();
}


Solution 2: user14089096

You can simply add document id in collection Like thisFirebaseFirestore.instance.Collection(seniornotice/documentname)