googlearchive / firebase-dart

Dart wrapper for Firebase
https://pub.dev/packages/firebase
404 stars 144 forks source link

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

Open halvorsen opened 3 years ago

halvorsen commented 3 years ago

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 commented 3 years ago

Good catch! Thanks