exists property

bool exists

True if the document exists.

@type {boolean} @name DocumentSnapshot#exists @readonly

final documentRef = firestore.doc('col/doc');

documentRef.get().then((documentSnapshot) {
  if (documentSnapshot.exists) {
    print('Data: ${JSON.stringify(documentSnapshot.data())}');
  }
});

Implementation

bool get exists => this._fieldsProto != null;