list method
List every object whose key starts with prefix, with full metadata.
Same RAW string-prefix rule as deletePrefix: list('photos')
matches photos/a, photos_old/b, and photos2; list('photos/')
matches only photos/*. The empty prefix lists everything.
Implementation
@override
Future<List<ObjectInfo>> list(String prefix) async {
checkNotDisposed();
final all = await _backing.list(prefix);
final results = <ObjectInfo>[];
for (final info in all) {
// Only manifest records contribute; chunks are skipped.
if (!info.key.endsWith(manifestSuffix)) continue;
final logicalKey = info.key.substring(
0,
info.key.length - manifestSuffix.length,
);
final manifest = await _readManifest(logicalKey);
if (manifest == null) continue; // race with delete
results.add(
ObjectInfo(
key: logicalKey,
size: manifest.totalSize,
contentType: manifest.contentType,
metadata: manifest.metadata,
lastModified: info.lastModified,
),
);
}
return results;
}