Skip to content

Instantly share code, notes, and snippets.

/*
This implementation is based on the Auto-ID approach from the following source:
https://stackoverflow.com/a/46801925
*/
static Future<Object> getRandomDocument(String collectionId) async {
final randomId =
FirebaseFirestore.instance.collection(collectionId).doc().id;
final documentSnapshot = await () async {