maxPixelRatio property

  1. @Deprecated('Use pixelRatios instead')
int maxPixelRatio

The maximum pixel ratio for images on HiDPI displays.

The loader automatically detects the device's display pixel ratio and accordingly loads high resolution images. The application has to provide images with the following naming schema:

1x resolution files are named "{imageName}@1x.png" 2x resolution files are named "{imageName}@2x.png" 3x resolution files are named "{imageName}@3x.png"

The default maximum pixel ratio is 2. Therefore the application has to provide images with the @1x and @2x suffix (or images with no name suffix to ignore this feature entirely).

var resourceManager = new ResourceManager();
resourceManager.addBitmapData("test", "images/test@1x.png");

Implementation

@Deprecated('Use pixelRatios instead')
int get maxPixelRatio =>
    pixelRatios.fold<double>(0, (a, b) => a > b ? a : b).round();
  1. @Deprecated('Use pixelRatios instead')
void maxPixelRatio=(int value)

Implementation

@Deprecated('Use pixelRatios instead')
set maxPixelRatio(int value) {
  pixelRatios = List<double>.generate(value, (v) => 1.0 + v);
}