i am using flutter_native_image plugin in my flutter windows application to compress the image files before uploading to firebase storage. but i am recieving these errors:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method compressImage on channel flutter_native_image) #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:320:7) #1 FlutterNativeImage.compressImage (package:flutter_native_image/flutter_native_image.dart:22:16) #2 _addorder2State._uploadImages (package:eaziprep_app_desktop/addorder2.dart:67:29)
this is my source code:
for (File imageFile in _imageList) {
// Compress the image using flutter_native_image
File compressedFile = await FlutterNativeImage.compressImage(
imageFile.path,
quality: 80, // Set the quality (0 - 100)
targetWidth: 800, // Set the target width
targetHeight: 800, // Set the target height
);
Reference storageReference = FirebaseStorage.instance
.ref()
.child("images/${DateTime.now().millisecondsSinceEpoch}.jpg");
// Upload the compressed image to Firebase Storage
UploadTask uploadTask = storageReference.putFile(compressedFile);
await uploadTask.whenComplete(() => print('Image uploaded'));
String downloadURL = await storageReference.getDownloadURL();
imageUrls.add(downloadURL);
}
best regards.