isDpr method

bool isDpr(
  1. Map<String, String> params
)

Implementation

bool isDpr(Map<String, String> params) {
  var width = params['w'];
  var hasWidth = width != null && isNotBlank(params['w']);

  var height = params['h'];
  var hasHeight = (height != null) && height.isNotEmpty;

  var aspectRatio = params['ar'];
  var hasAspectRatio = (aspectRatio != null) && aspectRatio.isNotEmpty;

  // If `params` have a width param or _both_ height and aspect
  // ratio parameters then the srcset to be constructed with
  // these params _is dpr based_.
  return hasWidth || (hasHeight && hasAspectRatio);
}