applyDeviceOverrides method

Future<void> applyDeviceOverrides(
  1. Device device
)

Configure the Test device to match the configuration of the supplied device

Note: these settings will persist across multiple tests in the same file. It is recommended that you reset upon completion.

device the desired configuration to apply

Implementation

Future<void> applyDeviceOverrides(Device device) async {
  await setSurfaceSize(Size(device.size.width, device.size.height));
  this.window.physicalSizeTestValue = device.size;
  this.window.devicePixelRatioTestValue = device.devicePixelRatio;
  this.window.platformDispatcher.textScaleFactorTestValue = device.textScale;
  this.window.platformDispatcher.platformBrightnessTestValue =
      device.brightness;
  this.window.safeAreaTestValue = device.safeArea;
}