pixelRatio property

double get pixelRatio

设备的像素密度

Implementation

double get pixelRatio {
  if (context == null) {
    return 0;
  }
  if (_pixelRatio == null || _pixelRatio == 0) {
    var view = View.of(context!);
    _pixelRatio = view.devicePixelRatio;
  }
  return _pixelRatio ?? 0;
}