startCamera method

  1. @override
Future<int?> startCamera({
  1. double quality = 1.0,
  2. String facing = 'back',
  3. String aspectRatio = '3:4',
})
override

Starts the camera with the specified configuration.

Implementation

@override
Future<int?> startCamera({
  double quality = 1.0,
  String facing = 'back',
  String aspectRatio = '3:4',
}) async {
  try {
    return await _channel.invokeMethod<int>('startCamera', {
      'quality': quality,
      'facing': facing,
      'frontCamera': facing == 'front',
      'aspectRatio': aspectRatio,
    });
  } on MissingPluginException {
    // GStreamer may not be available on this system — return null gracefully.
    return null;
  } on PlatformException catch (e) {
    throw PlatformException(
      code: e.code,
      message: 'Linux camera error: ${e.message}',
      details: e.details,
    );
  }
}