Flutter 如何获取Firestore文档快照流,其中id由其他流发出?

Flutter 如何获取Firestore文档快照流,其中id由其他流发出?,flutter,dart,google-cloud-firestore,rxdart,Flutter,Dart,Google Cloud Firestore,Rxdart,我想从Firestore创建一个DocumentSnapshots流,其中可以从另一个流提供文档id 每当用户id发生更改时(例如,登录或注销后),我的AuthRepository都会发出用户id 假设它看起来像这样: Stream get userId=>\u firebaseAuth.onAuthStateChanged.map((用户){ 如果(用户!=null) 返回user.uid; 否则{ 返回null; } }); 然后我想使用此流从Firestore获取DocumentSnap

我想从Firestore创建一个
DocumentSnapshots
流,其中可以从另一个流提供文档id

每当用户id发生更改时(例如,登录或注销后),我的AuthRepository都会发出用户id

假设它看起来像这样:

Stream get userId=>\u firebaseAuth.onAuthStateChanged.map((用户){
如果(用户!=null)
返回user.uid;
否则{
返回null;
}
});
然后我想使用此流从Firestore获取
DocumentSnapshot
流,例如,以
\u Firestore.document('users/$id').snapshots()的形式:

//我们可以在这里访问Firestore
最终消防仓库(Firestore);;
Stream get\u usersSnapshotsStream{
//我应该在这里使用什么?异步扩展?映射?转换?
return\u authRepository.userId.map((id){
//我想访问_firestore.document('users/$id').snapshots()
});
}
我应该在
\u userssnapshotstream
中执行什么流操作,以始终获取从其他流提供的给定用户id的最新文档