Search code examples
fluttercamera

flutter: Is there a way to use the front camera?


I want to use the front camera in flutter. Instead of shooting mode, I want to make the front camera without a shooting button appear in real time for only about a third of the page. Do you have any reference material?


Solution

  • Reference Material -

    https://flutter.dev/docs/cookbook/plugins/picture-using-camera#complete-example

    Here, final cameras = await availableCameras(); return the list of available cameras, and motstly the second one (index no 1) is front camera. To use front camera, just change final firstCamera = cameras.first; to final firstCamera = cameras[1];

    CameraPreview(_controller)
    

    change or bound it with sized box to determine how much you wanna use to preview the camera's output!