contains method

bool contains(
  1. Object field
)

Whether the field exists in the document, also when its value is null. False if the document does not exist.

field is a String (dots separate nested fields, 'address.city') or a FieldPath. Throws an ArgumentError for an invalid path.

Implementation

bool contains(Object field) {
  final FieldPath fieldPath = _fieldPathOf(
    'DocumentSnapshot.contains',
    field,
  );
  return document?.getField(fieldPath.internalPath) != null;
}