Widget catageriesList(String airportId, locationId) {
return Container(
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection("Airport").doc(widget.airportId).collection("location").doc(locationId).collection("Catagorie").snapshots(),
builder: (context, snapshot) {
return snapshot.data == null
? Container() : ListView.builder(
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) {
DocumentSnapshot data = snapshot.data!.docs[index];
print("object");
return Catageries(
catagerieId: data["Catagorie_id"],
catagerieName: data["Catagorie_name"],
);
}
);
},
),
);
}
CodePudding user response:
The error means you're passing null
as a document path and this is in this line:
stream: FirebaseFirestore.instance.collection("Airport").doc(widget.airportId).collection("location").doc(locationId).collection("Catagorie").snapshots(),
This means widget.airportId
is null.
Solution:
You method catageriesList
has an used argument airportId
which you should be pass as the document path.
Update this line of code:
stream: FirebaseFirestore.instance.collection("Airport").doc(widget.airportId).collection("location").doc(locationId).collection("Catagorie").snapshots(),
to this:
stream: FirebaseFirestore.instance.collection("Airport").doc(airportId).collection("location").doc(locationId).collection("Catagorie").snapshots(),