startCamera method

Future<void> startCamera({
  1. double quality = 1.0,
  2. dynamic cameraPreference,
  3. dynamic aspectRatio,
})

Starts the camera on the native platform with the specified configuration. Returns the texture ID required for the preview.

Implementation

Future<void> startCamera({
  double quality = 1.0,
  dynamic cameraPreference, // CamPreference enum
  dynamic aspectRatio, // CamRatio enum
}) async {
  String facing = 'back';
  // Determine if we should start with front or rear camera.
  if (cameraPreference.toString().toLowerCase().contains('front')) {
    facing = 'front';
  }

  // Invoke 'startCamera' via the platform interface.
  final int? id = await FlutterCropCameraPlatform.instance.startCamera(
    quality: quality,
    facing: facing,
    aspectRatio: _getRatioString(aspectRatio),
  );
  textureId = id;
}