You can create a separate method with return type Stream.
final CollectionReference collection =
FirebaseFirestore.instance.collection('employees');
Stream<QuerySnapshot> getStream(String query) {
/// Perform your 5 condition here
return collection.snapshots();
}
stream: getStream(query),
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…