pickMedia method
Implementation
@override
Future<String?> pickMedia(
MediaSource source, MediaType type, MediaOptions options) async {
try {
// Check if freeform cropping is enabled
if (options.cropOptions?.freeform == true && options.cropOptions?.enableCrop == true) {
// Handle interactive cropping
return await _pickMediaWithInteractiveCrop(source, type, options);
}
final result = await methodChannel.invokeMethod<String>('pickMedia', {
'source': source.toString().split('.').last,
'type': type.toString().split('.').last,
'options': options.toMap(),
});
return result;
} on PlatformException catch (e) {
throw Exception('Error picking media: ${e.message}');
}
}