streamSingleData<T> method
Streams single data from the specified path and id and returns it as a Stream<T>.
path - The path to the data.
id - The id of the data.
builder - The function to build the data.
Implementation
Stream<T> streamSingleData<T>({
required String path,
required String id,
required T Function(Map<String, dynamic>? data, String documentId) builder,
}) {
final reference = _fireStore.collection(path).doc(id);
final snapshots = reference.snapshots();
return snapshots.map((snapshot) => builder(snapshot.data(), snapshot.id));
}