flutter_dual_camera 0.0.2
flutter_dual_camera: ^0.0.2 copied to clipboard
A Flutter plugin that enables access to dual camera functionality on Android devices, allowing simultaneous capture from multiple cameras.
Flutter Dual Camera #
A Flutter plugin that enables simultaneous access to multiple cameras on a device, specifically designed for devices with dual camera systems (wide-angle and telephoto).
Features #
- Check if the device supports dual cameras
- Start and stop dual camera preview
- Capture photos from both cameras simultaneously
- Works on both iOS and Android platforms
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_dual_camera: ^0.0.1
Platform Setup #
iOS #
Add the following keys to your Info.plist
file:
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera to take photos with both cameras simultaneously.</string>
Android #
Add the following permissions to your AndroidManifest.xml
file:
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
Usage #
import 'package:flutter_dual_camera/flutter_dual_camera.dart';
// Check if device supports dual camera
bool isSupported = await FlutterDualCamera.isDualCameraSupported();
// Start camera preview
if (isSupported) {
await FlutterDualCamera.startDualCameraPreview();
}
// Capture images from both cameras
Map<String, String> imagePaths = await FlutterDualCamera.takeDualPicture();
String wideImagePath = imagePaths['wide'];
String telephotoImagePath = imagePaths['telephoto'];
// Stop camera preview
await FlutterDualCamera.stopDualCameraPreview();
Example #
Check out the example application for a complete demo.
Notes & Limitations #
- This plugin requires a device with dual camera hardware (typically wide and telephoto lenses)
- The plugin currently doesn't support displaying the camera preview in the UI, only capturing images
- For advanced camera UI features, consider using this plugin together with camera UI packages
Contributing #
Contributions are welcome! If you find a bug or want a feature, please open an issue.
License #
This project is licensed under the MIT License - see the LICENSE file for details.