File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/firebase_snippets_app/lib/snippets Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -453,7 +453,12 @@ class FirestoreSnippets extends DocSnippet {
453453 void getDataOnce_multipleDocumentsFromACollection () {
454454 // [START get_data_once_multiple_documents_from_a_collection]
455455 db.collection ("cities" ).where ("capital" , isEqualTo: true ).get ().then (
456- (res) => print ("Successfully completed" ),
456+ (querySnapshot) {
457+ print ("Successfully completed" );
458+ for (var docSnapshot in querySnapshot.docs) {
459+ print ('${docSnapshot .id } => ${docSnapshot .data ()}' );
460+ }
461+ },
457462 onError: (e) => print ("Error completing: $e " ),
458463 );
459464 // [END get_data_once_multiple_documents_from_a_collection]
@@ -462,7 +467,12 @@ class FirestoreSnippets extends DocSnippet {
462467 void getDataOnce_getAllDocumentsInACollection () {
463468 // [START get_data_once_get_all_documents_in_a_collection]
464469 db.collection ("cities" ).get ().then (
465- (res) => print ("Successfully completed" ),
470+ (querySnapshot) {
471+ print ("Successfully completed" );
472+ for (var docSnapshot in querySnapshot.docs) {
473+ print ('${docSnapshot .id } => ${docSnapshot .data ()}' );
474+ }
475+ },
466476 onError: (e) => print ("Error completing: $e " ),
467477 );
468478 // [END get_data_once_get_all_documents_in_a_collection]
You can’t perform that action at this time.
0 commit comments