$find<R extends FirestoreEntity<R> > method
Finds the first R entity in the corresponding subcollection of this entity matching the query.
Returns null if no entity was found.
Implementation
Future<R?> $find<R extends FirestoreEntity<R>>({Query<R> Function(Query<R> query)? query}) async {
var subCollection = getSubCollection<R>();
Query<R> q = subCollection;
if (query != null) {
q = query(q);
}
var snapshot = await q.get();
if (snapshot.size == 0) return null;
return snapshot.docs.first.data();
}