captureStorageStepSnapshot function

Future<StorageStepSnapshot?> captureStorageStepSnapshot({
  1. required bool enabled,
})

Captures storage only when storage diagnostics are enabled.

Returning null means the step must not capture a follow-up snapshot or calculate a diff. This keeps the disabled path free of storage work.

Implementation

Future<StorageStepSnapshot?> captureStorageStepSnapshot({
  required bool enabled,
}) async {
  if (!enabled) return null;
  return StorageStepSnapshot(
    publicValues: capturePublicStorage(),
    secureValues: captureSecureStorage(),
    keychainValues: await captureKeychainStorage(),
  );
}