Skip to content
tezvyn:

What native iOS and Android config does the Flutter camera plugin need?

Source: pub.devEasyHow cards are made

Tests native platform knowledge beyond Dart. iOS requires NSCameraUsageDescription and NSMicrophoneUsageDescription in Info.plist. Android needs minSdk 24 and choosing between CameraX or Camera2 implementations.

What's really being asked

This question checks if you understand that adding a Flutter plugin to pubspec.yaml is only the Dart-side dependency. Senior engineers know that many plugins, especially hardware-facing ones like camera, require explicit native platform configuration. The interviewer wants to see that you do not treat native layers as opaque black boxes and that you understand the permission and privacy models on both iOS and Android.

The full answer

First, iOS configuration. You must open ios/Runner/Info.plist and add two keys: NSCameraUsageDescription and NSMicrophoneUsageDescription. Both require human-readable usage description strings. Without these, iOS terminates the app when camera or microphone access is requested. Second, Android configuration. The reference specifies that the endorsed camera_android_camerax implementation requires SDK 24 or higher. The Android setup section does not list mandatory AndroidManifest.xml entries for the default CameraX path, but it directs you to separate instructions if you use the legacy camera_android Camera2 implementation or if you need background image streaming. Third, mention that runtime permission errors such as CameraAccessDenied or AudioAccessDenied must be handled in Dart. Fourth, note that lifecycle management is no longer handled by the plugin as of version 0.5.0, so you must manage CameraController disposal and reinitialization in didChangeAppLifecycleState.

The mistakes people make

Claiming that Flutter automatically injects all necessary native permissions. Omitting the NSMicrophoneUsageDescription on iOS, which causes a crash when recording video with audio. Adding unnecessary AndroidManifest.xml permission lines without checking which implementation is active. Not knowing the minSdk 24 requirement for Android. Confusing compileSdkVersion with minSdkVersion. Forgetting that iOS usage descriptions are mandatory strings, not just keys.

What usually comes next

How do you handle permission errors at runtime, such as CameraAccessDenied or AudioAccessDenied? What is the difference between camera_android and camera_android_camerax? How would you handle lifecycle states now that the plugin no longer manages them automatically? What changes if you need image streaming while the app is in the background?

A concrete example

Suppose you are building a video recording feature. On iOS, you open Info.plist and add NSCameraUsageDescription with the string "This app uses the camera to record videos" and NSMicrophoneUsageDescription with "This app uses the microphone to record audio." On Android, you verify that android/app/build.gradle sets minSdkVersion to 24 or higher to satisfy the CameraX requirement. You also confirm you are using the default camera_android_camerax implementation rather than the legacy Camera2 path. Then in Dart, you initialize the CameraController, catch CameraException for denied permissions, and prompt the user accordingly.

Interview question

Which native setup is required for the Flutter camera plugin beyond adding it to pubspec.yaml?

  • a.Flutter automatically injects all native permissions after pub get
  • b.iOS: Camera background mode; Android: minSdkVersion 21 using legacy Camera2
  • c.iOS: NSCameraUsageDescription only; Android: compileSdkVersion 24
  • d.iOS: NSCameraUsageDescription and NSMicrophoneUsageDescription; Android: minSdkVersion 24 for CameraXCorrect
Why?

The plugin does not auto-configure native layers: iOS requires both NSCameraUsageDescription and NSMicrophoneUsageDescription strings in Info.plist, and Android's default CameraX implementation requires minSdkVersion 24. Option C is tempting because it names a real iOS key but omits the microphone description and confuses compileSdk with minSdk, while D reflects the common misconception that Flutter handles native permissions automatically.

Just read this? Test yourself on what you have been reading.

Read the original → pub.dev

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on flutter — each one lists the topics its interview covers.

See open roles