Firestore get for non-existent values (DocumentSnapshot) #6311
Unanswered
tgpsantos
asked this question in
Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
When we try to get a field that does not exist in a
DocumentSnapshot
an exception is thrown.Error: Bad state: field does not exist within the DocumentSnapshotPlatform
In order to get fields that might be null, we can do the following
It's a bit of a pain having to call <Map<String, dynamic>> every time I want to instantiate a DocumentSnapshot, so I was wondering if it's possible to have a null check in the
get('field')
method that would return null if the field didn't exist. Or is there a better way besides this one?Beta Was this translation helpful? Give feedback.
All reactions