'how to get list of documents where their id given from another collection [duplicate]

I have two collections

collections pdm:

enter image description here

I want to make a stream reads favorite providers for user

 Stream<List<FavoriteProvider>> get favoriteProviders{
    return favoriteProviderCollection.where('userID', isEqualTo: this.uid).snapshots()
      .map(_favoriteproviderListfromsnapshot);
  }

  List<FavoriteProvider> _favoriteproviderListfromsnapshot (QuerySnapshot snapshot){
     return snapshot.docs.map((doc){
      var data = doc.data() as Map<String, dynamic>;
      return FavoriteProvider(
        providerID: data['providerID'],
        userID: data['userID']
      );
    }).toList();
  }

but how to complete?

I tried this but it seems not good

final favoriteProviders = Provider.of<List<FavoriteProvider>>(context);
      return new StreamBuilder(
        stream: FirebaseFirestore.instance.collection('providers').doc(favoriteProviders).snapshots(),
        builder: (context, snapshot) {
          if (!snapshot.hasData) {
            return Container();
          }
          List<ServineraProvider> servineraProviders = snapshot.data;
          return ListView.builder(...)
}
);

any one can help me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source