devicePixelRatio property

double get devicePixelRatio

The number of device pixels for each logical pixel.

This is used by some renderers (like WebParagraph on the web) to regenerate the text bitmap when the scale changes.

Implementation

double get devicePixelRatio => _devicePixelRatio;
set devicePixelRatio (double value)

Implementation

set devicePixelRatio(double value) {
  if (_devicePixelRatio == value) {
    return;
  }
  _devicePixelRatio = value;
  if (kIsWeb) {
    // The `WebParagraph` implementation renders the paragraph as an image. After a
    // `devicePixelRatio` change, the image needs to be regenerated or it would look blurry.
    markNeedsPaint();
  }
}