getPersistenceKey method

FilePersistorKey? getPersistenceKey()

Implementation

FilePersistorKey? getPersistenceKey() {
  final documentSettings = persistorSettings;
  if (documentSettings is FilePersistorSettings<T>) {
    final keyBuilder = documentSettings.key;
    final snap = get();

    if (keyBuilder is FilePersistorDocumentKeyBuilder<T> && snap != null) {
      return (keyBuilder as FilePersistorDocumentKeyBuilder).build(snap);
    }

    if (keyBuilder is FilePersistorCollectionKeyBuilder<T>) {
      return keyBuilder.build();
    }
  }

  return null;
}