/// Nothing in this file touches cloud_firestore. Every call below shares a name /// with a Firestore query method and must NOT be extracted. class Query { Query where(String field, {Object? isEqualTo}) => this; Query limit(int n) => this; Future> get() async => const []; Stream> snapshots() => const Stream.empty(); } class CollectionReference extends Query { CollectionReference collection(String path) => this; } class FakeFirestore { CollectionReference collection(String path) => CollectionReference(); } class Limiter { List limit(List values, int n) => values.take(n).toList(); } Future lookalikes(List values) async { values.where((value) => value > 2).take(3).toList(); Limiter().limit(values, 2); await FakeFirestore() .collection('lookalike') .where('a', isEqualTo: 1) .limit(2) .get(); Query().snapshots(); }