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'.
CodePudding user response:
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.