debugPhysicalChunkSize method
Physical size of chunk index's OPFS file (0 when it does not exist).
Diagnostic hook for tests: it temporarily releases this instance's handle on the chunk because a sync access handle is exclusive.
Implementation
Future<int> debugPhysicalChunkSize(int index) async { _checkOpen();
return _serialize(() async {
await _closeChunkHandle(index);
final client = _pool.clientForChunk(index);
try {
final opened = await client.open(
chunkPathFor(path, index),
create: false,
);
try {
return await client.size(opened.handle);
} finally {
await client.closeHandle(opened.handle);
}
} on WebFileSystemException catch (error) {
if (error.isNotFound) return 0;
rethrow;
}
});
}