flutter-image-pickerlisted
Install: claude install-skill noory-code/noory-ai
# Flutter Image Picker
Pick images and videos from the gallery or camera. Commonly used for profile photos and photo uploads.
---
## Installation
```bash
flutter pub add image_picker
```
## Platform Setup
### iOS (ios/Runner/Info.plist)
```xml
<key>NSPhotoLibraryUsageDescription</key>
<string>Gallery access is required to select a profile photo.</string>
<key>NSCameraUsageDescription</key>
<string>Camera access is required to take a profile photo.</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for video recording.</string>
```
### Android
Android 13 and above are supported automatically. No additional setup is required.
---
## Quick Reference
### Single Image Selection
```dart
import 'package:image_picker/image_picker.dart';
final picker = ImagePicker();
// pick from gallery
Future<void> pickFromGallery() async {
final XFile? image = await picker.pickImage(
source: ImageSource.gallery,
maxWidth: 1024,
maxHeight: 1024,
imageQuality: 80, // 0-100
);
if (image != null) {
final bytes = await image.readAsBytes();
final path = image.path;
// upload or display
}
}
// take a photo with the camera
Future<void> takePhoto() async {
final XFile? image = await picker.pickImage(
source: ImageSource.camera,
preferredCameraDevice: CameraDevice.front, // front/rear
);
}
```
### Multiple Image Selection
```dart
Future<void> pickMultipleImages() async {
final List<XFile> images = await