documentFromObject method
Returns a reference to a document using an object.
Implementation
DocumentRef documentFromObject(dynamic object, { String? subcollection }) {
if (object == null) {
throw NullIDException("Cannot get document reference from null object");
}
final String? className = LS.classNames[object.runtimeType];
if (className == null) {
throw UnsupportedError('No class name found for type: $className. Consider re-generating Firestorm data classes.');
}
if (subcollection != null) {
return LS.instance.collection(className).doc(subcollection).collection(subcollection).doc(object.id);
}
return LS.instance.collection(className).doc(object.id);
}