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 {
453
453
void getDataOnce_multipleDocumentsFromACollection () {
454
454
// [START get_data_once_multiple_documents_from_a_collection]
455
455
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
+ },
457
462
onError: (e) => print ("Error completing: $e " ),
458
463
);
459
464
// [END get_data_once_multiple_documents_from_a_collection]
@@ -462,7 +467,12 @@ class FirestoreSnippets extends DocSnippet {
462
467
void getDataOnce_getAllDocumentsInACollection () {
463
468
// [START get_data_once_get_all_documents_in_a_collection]
464
469
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
+ },
466
476
onError: (e) => print ("Error completing: $e " ),
467
477
);
468
478
// [END get_data_once_get_all_documents_in_a_collection]
You can’t perform that action at this time.
0 commit comments