startCamera method
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';
}
final payload = {
'quality': quality,
'facing': facing,
'frontCamera': facing == 'front', // Fallback for various native versions
'aspectRatio': _getRatioString(aspectRatio),
};
// Invoke 'startCamera' and receive the platform-side texture ID.
final int? id = await _channel.invokeMethod('startCamera', payload);
textureId = id;
}