screenPixelRatio property

double screenPixelRatio

screenPixelRatio is a MediaQuery function. The number of device pixels for each logical pixel. This number might not be a power of two. Indeed, it might not even be an integer. For example, the Nexus 6 has a device pixel ratio of 3.5.

Implementation

double get screenPixelRatio {
  if (_context == null) throw NoContextException();
  try {
    _mediaQuery = MediaQuery.maybeOf(_context!);
    if (_mediaQuery == null) throw NoContextException();
    return _mediaQuery!.devicePixelRatio;
  } catch (e) {
    throw NoContextException();
  }
}