ensureFirestoreRoot function
Creates the project's root document (root) when missing.
Implementation
Future<void> ensureFirestoreRoot(FirebaseFirestore firestore, String root, String projectId) async {
final ref = firestore.doc(root);
if ((await ref.get()).exists) return;
await ref.set({'project': projectId});
}