runWithDeviceOverrides method

Future<void> runWithDeviceOverrides(
  1. Device device, {
  2. required Future<void> body(),
})

Configure the Test device for the duration of the supplied operation and revert

device the desired configuration to apply

body the closure you wish to be executed with the device configuration applied

Implementation

Future<void> runWithDeviceOverrides(
  Device device, {
  required Future<void> Function() body,
}) async {
  await applyDeviceOverrides(device);
  try {
    await body();
  } finally {
    await resetDeviceOverrides();
  }
}