getDatastoreName method
Returns the name of a file data store name for a given document and its persistor settings. Uses the custom persistence key of the document if specified in its persistor settings, otherwise it defaults to the document's collection name.
Implementation
String getDatastoreName() {
String dataStoreName;
final documentSettings = persistorSettings;
if (documentSettings is FilePersistorSettings) {
dataStoreName =
documentSettings.getPersistenceKey?.call(this) ?? collection;
if (isEncryptionEnabled()) {
dataStoreName += '.encrypted';
}
} else {
dataStoreName = collection;
}
return dataStoreName;
}