createViewConfiguration method

ViewConfiguration createViewConfiguration ()

Returns a ViewConfiguration configured for the RenderView based on the current environment.

This is called during construction and also in response to changes to the system metrics.

Bindings can override this method to change what size or device pixel ratio the RenderView will use. For example, the testing framework uses this to force the display into 800x600 when a test is run on the device using flutter run.

Implementation

ViewConfiguration createViewConfiguration() {
  final double devicePixelRatio = window.devicePixelRatio;
  return ViewConfiguration(
    size: window.physicalSize / devicePixelRatio,
    devicePixelRatio: devicePixelRatio,
  );
}