getData<T> function
Convenience Method to access the data of a Query as a stream while applying a mapping function on each document
qery
: the data source
mapper
: mapping function that gets applied to every document in the query.
Implementation
Stream<List<T>> getData<T>(Query query, DocumentMapper<T> mapper)
{
return query.snapshots().map((snapShot) => snapShot.documents.map(mapper)
.toList());
}