Skip to content
Advertisement

Tag: google-cloud-firestore

Firestore – Why check if DocumentSnapshot is not null AND call exists?

Take a look at this code example from the Firestore documentation: https://firebase.google.com/docs/firestore/query-data/get-data Why check if document != null? If I read the source code correctly (beginner), the exists method checks for nullity internally. Answer A successfully completed task will never pass null for the DocumentSnapshot. If the requested document does not exist, you’ll get an empty snapshot. This means that:

Advertisement