import 'dart:io';

import 'package:camera/camera.dart';
import 'package:get/get.dart';

Future<CameraController> getCameraController() async {
  final cameraDescription = (await availableCameras())
      .where(
        (element) => element.lensDirection == CameraLensDirection.front,
      )
      .first;

  return CameraController(cameraDescription, ResolutionPreset.high,
      enableAudio: false,
      imageFormatGroup:
          Platform.isIOS ? ImageFormatGroup.bgra8888 : ImageFormatGroup.yuv420);
}

getCameraPreviewScale(double ratio) {
  return 1 / (ratio * Get.size.aspectRatio);
}
