user16906111
user16906111

Reputation:

The getter 'documentChanges' isn't defined

This snippet of code:

FirebaseFirestore.instance.collection('users').snapshots().listen((event){
      event.documentChanges.forEach((change){} //error
}

for track the values of users document, But documentChanges attribute has this error:

The getter 'documentChanges' isn't defined for the type 'QuerySnapshot<Map<String, dynamic>>'. Try importing the library that defines 'documentChanges', correcting the name to the name of an existing getter, or defining a getter or field named 'documentChanges'.

Upvotes: 1

Views: 254

Answers (1)

Peter Obiechina
Peter Obiechina

Reputation: 2835

Use event.docChanges.forEach((change) {}); instead of event.documentChanges.forEach((change) {});

DEPRECATED: documentChanges has been deprecated in favor of docChanges as of version 0.14.0. You can view the changelog here.

Upvotes: 0

Related Questions