chooseNumericVariant method Null safety

double chooseNumericVariant(
  1. BuildContext context
)

Return the best choice of resolution variants for current device pixel ratio in the double type. Example: 1.5

Implementation

double chooseNumericVariant(BuildContext context) {
  var currentRatio = MediaQuery.of(context).devicePixelRatio;
  String bestVariant =
      _AssetVariantChooser._findBestVariant(_candidates, currentRatio) ??
          _defaultRatioName;
  if (bestVariant == _defaultRatioName) {
    bestVariant = _AssetVariantChooser.assetName;
  }

  return _AssetVariantChooser._parseScale(bestVariant);
}