compressToJPEG method
Implementation
@override
Future<String?> compressToJPEG(String imagePath) async {
try {
String? result = await methodChannel.invokeMethod<String>(
'compressToJPEG',
{'imagePath': imagePath}, // Corrected map syntax
);
return result;
} catch (e) {
if (kDebugMode) {
print("Error compressing image: $e");
}
return null; // Handle exceptions gracefully
}
}