applyDeviceOverrides method
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 * device.devicePixelRatio;
this.window.devicePixelRatioTestValue = device.devicePixelRatio;
this.window.platformDispatcher.textScaleFactorTestValue = device.textScale;
this.window.platformDispatcher.platformBrightnessTestValue =
device.brightness;
this.window.safeAreaTestValue = device.safeArea;
}