list method

  1. @override
Future<List<ObjectInfo>> list(
  1. String prefix
)
override

Lists with PLAINTEXT sizes where the sidecar carries them.

Unlike head, list() never probes file headers — one byte-read per entry would make directory listings O(total content). The rare crash-window entry whose sidecar size is missing reports its ciphertext size here; call head on it for the derived exact size.

Implementation

@override
Future<List<ObjectInfo>> list(String prefix) async {
  checkNotDisposed();
  final objects = await _inner.list(prefix);

  return objects
      // One-shot plaintext temps are internal bookkeeping, not user
      // objects — a crash can leave one behind until the next sweep.
      .where((info) => !info.key.contains(decryptTempMarker))
      // Correct sizes for encrypted files using sidecar metadata.
      .map((info) {
        if (info.metadata[_metaEncrypted] == 'true') {
          final originalSize = int.tryParse(
            info.metadata[_metaOriginalSize] ?? '',
          );
          if (originalSize != null) {
            return info.copyWith(size: originalSize);
          }
        }
        return info;
      })
      .toList();
}