openCamera method

  1. @override
Future<void> openCamera(
  1. BuildContext context,
  2. ShowCameraAction cameraAction,
  3. ScopeManager? scopeManager
)
override

Opens the configured camera flow.

Implementation

@override
Future<void> openCamera(BuildContext context, ShowCameraAction cameraAction,
    ScopeManager? scopeManager) async {
  final isDefault = Utils.getBool(
      scopeManager?.dataContext.eval(cameraAction.options?['default']),
      fallback: false);

  if (isDefault && !kIsWeb) {
    await defaultCamera(context, cameraAction, scopeManager);
  } else {
    final faceDetection = scopeManager?.dataContext
        .eval(cameraAction.options?['faceDetection'])?['enabled'];
    if (Utils.getBool(faceDetection, fallback: false)) {
      debugPrint(
          'Deprecated: Face detection is no longer available here. Use the "openFaceCamera" action instead.');
    }
    await bespokeCamera(context, cameraAction, scopeManager);
  }
}