assertPhysicalDeviceStorageAcknowledged static method

void assertPhysicalDeviceStorageAcknowledged({
  1. required bool deviceIsPhysical,
  2. required bool allowMutation,
  3. required bool resetStorage,
})

Pure gate used by requirePhysicalDeviceStorageAcknowledgment and tests.

Implementation

static void assertPhysicalDeviceStorageAcknowledged({
  required bool deviceIsPhysical,
  required bool allowMutation,
  required bool resetStorage,
}) {
  if (!deviceIsPhysical) return;
  if (allowMutation || resetStorage) return;
  throw StateError(
    'Integration tests on a physical device mutate app storage '
    '(capture a pre-suite baseline and restore it between tests). '
    'Pass --allow-device-storage-mutation to acknowledge this, or '
    '--reset-device-storage to wipe storage first on a disposable device.',
  );
}