compressToJPEG method

  1. @override
Future<String?> compressToJPEG(
  1. String imagePath
)
override

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
  }
}