aspectRatio property

double get aspectRatio

Implementation

double get aspectRatio {
  double _aspectRatio = 1.0;
  if (width != null && height != null) {
    _aspectRatio = width! / height!;
  } else if (controller != null) {
    _aspectRatio = controller!.value.aspectRatio;
  }

  // sensorOrientation can be [0, 90, 180, 270],
  // while 90 / 270 is reverted to width and height.
  if ((cameraDescription?.sensorOrientation ?? 0 / 90) % 2 == 1) {
    _aspectRatio = 1 / _aspectRatio;
  }
  return _aspectRatio;
}