getCamera static method

Future<CameraDescription> getCamera(
  1. CameraLensDirection direction
)

Returns the CameraDescription of the camera that faces direction.

Implementation

static Future<CameraDescription> getCamera(CameraLensDirection direction) async => await availableCameras().then(
      (List<CameraDescription> cameras) => cameras.firstWhere(
        (CameraDescription camera) => camera.lensDirection == direction,
      ),
    );