In my code :

final cameras = await availableCameras();
  // Get a specific camera from the list of available cameras.
  final firstCamera = cameras.first;

Package :

import 'package:camera/camera.dart';

Unhandled Exception: Bad state: No element

0 List.first (dart:core-patch/growable_array.dart:220:5)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>Can I use the camera please?</string>
<string>Can I use the mic please?</string>

Issue solved
In IOS camera is not available in emulator

Solution 1: David L.

The iOS Simulator doesn't have access to the camera. Trying to access it always results in a camera unavailable error. You'll notice that when trying to launch the camera app itself, you'll just get a static black screen with the UI but you can't take any pictures with it.