pickFromGallery method
Selects a photo from the device photo gallery.
Returns a BloomCapturedPhoto or null if cancelled.
Example:
final photo = await camera.pickFromGallery(imageQuality: 80);
Implementation
Future<BloomCapturedPhoto?> pickFromGallery({
double? maxWidth,
double? maxHeight,
int? imageQuality,
}) async {
try {
final XFile? file = await _picker.pickImage(
source: ImageSource.gallery,
maxWidth: maxWidth,
maxHeight: maxHeight,
imageQuality: imageQuality,
);
if (file == null) return null;
final bytes = await file.readAsBytes();
return BloomCapturedPhoto(
path: file.path,
bytes: bytes,
mimeType: file.mimeType ?? 'image/jpeg',
);
} catch (e, st) {
logger.error('BloomCamera: Gallery picker failed: $e', e, st);
return null;
}
}