pixelRatio property

  1. @override
num get pixelRatio
override

The current pixel ration of this canvas. See devicePixelRatio.

Implementation

@override
num get pixelRatio => _pixelRatio;
  1. @override
set pixelRatio (num pr)
override

Sets the pixel ration of this canvas and refreshes it.

Implementation

@override
set pixelRatio(num pr) {
  if (_pixelRatio != pr) {
    var n = pr.toInt();
    if (n != pr) {
      var pr2 = double.tryParse(pr.toStringAsFixed(4));
      pr = pr2 ?? pr;
    }

    _pixelRatio = pr;
    checkDimension();
    refresh();
  }
}