document method

XData document(
  1. QueryDocumentSnapshot<Object?> doc,
  2. Xfields fields
)

Implementation

XData document(QueryDocumentSnapshot<Object?> doc,Xfields fields) {
  var data = XData(data: doc.data() as Map<String, dynamic>,refrence: doc.reference.path);
  XData response = XData(data: {},refrence: doc.reference.path);
  for (var key in fields) {
    response.data.addAll({key.field: data.data.containsKey(key.field) ? data.data[key.field] : null});

  }
  return response;
}