Build a Camera App : Flutter In-App Camera
In many apps we need users to upload images by clicking a picture. For that, we can use the default camera app of the device but what if we need to integrate an in-app camera? Well, that is also possible with flutter. The flutter team has developed a package called camera
(https://pub.dev/packages/camera) which will let us do exactly this.
Let’s see how can we achieve this by a simple example.
Setting up the project
First of all, install the camera
package into your project by adding the following line into pubspec.yaml
file.
camera: ^0.8.1+3
— IOS Setup
IOS 10.0 or higher is required for this plugin.
Add the following lines in the Info.plist
file to set things up.
<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can I use the mic please?</string>
— Android Setup
Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle
file.
minSdkVersion 21
Now that our project set up is complete, we can start coding the app.