Being able to use the camera functionality is an important part of any mobile development framework, and Flutter provides the camera plugin for this purpose. The camera plugin allows you to get a list of the available cameras in the device, show previews, and take photos and videos.
The first step in order to use the camera is to set up the app. To do so, we'll proceed as follows:
- In the pubspec.yaml file, let's add the dependencies. We'll—of course—need camera, but also path (which we already added at the beginning of this project) and path_provider, to save and retrieve the photos we take from the app, as shown in the following code block:
camera: ^0.5.7
path_provider: ^1.4.4
For Android, you'll need to change the minimum Android SDK version to 21 (or higher) in your android/app/build.gradle file, as follows:
minSdkVersion...