aspectRatio property

double aspectRatio

Returns size.width / size.height when size is non-null, or 1.0. when size is null or the aspect ratio would be less than or equal to 0.0.

Implementation

double get aspectRatio {
  if (size == null) {
    return 1.0;
  }
  final double aspectRatio = size!.width / size!.height;
  if (aspectRatio <= 0) {
    return 1.0;
  }
  return aspectRatio;
}