Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

null returned from data in get() request of a non-existant firestore node #395

Open
halvorsen opened this issue Jul 13, 2021 · 1 comment
Labels

Comments

@halvorsen
Copy link

halvorsen commented Jul 13, 2021

I can get a null from this snapshot data when there is nothing at the document node i'm calling get() on. However snapshot.data() is not labeled as an optional.
final snapshot = await StorageCloudWeb.pathHelper.userBrowseInfoDocumentReference(userId).get().catchError((_) {});
final data = snapshot.data();
// data = null

using: firebase: ^9.0.1 (labeled as null safe)

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.2.3, on macOS 11.3.1 20E241 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.58.0)
[✓] Connected device (2 available)

@kevmoo
Copy link
Contributor

kevmoo commented Jul 15, 2021

Good catch! Thanks

@kevmoo kevmoo added the bug label Jul 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants