pickMultipleImages static method
Implementation
static Future<List<File>> pickMultipleImages() async {
try {
// For iOS, don't check permissions beforehand
// Let the system handle it
if (!Platform.isIOS) {
if (!await _requestPermissions()) {
throw Exception('Permission denied for gallery access');
}
}
final List<XFile> images = await _picker.pickMultiImage(
imageQuality: 80,
);
return images.map((xFile) => File(xFile.path)).toList();
} catch (e) {
// Provide a more helpful error message
if (e.toString().contains('Permission denied') ||
e.toString().contains('access denied')) {
throw Exception(
'Gallery access denied. Please grant photo library permission in your device settings.',
);
}
throw Exception('Error picking multiple images: $e');
}
}