getAspectRatioString method

String getAspectRatioString([
  1. String separator = ":"
])

Implementation

String getAspectRatioString([String separator = ":"]) {
  var h = height;
  var w = width;
  while (w.hasDecimal) {
    w = w * 10;
  }
  while (h.hasDecimal) {
    h = h * 10;
  }

  var gcd = w.findGreatestCommonDivisor(h.floor());
  return '${w ~/ gcd}$separator${h ~/ gcd}';
}