return FutureBuilder<File?>(
future: compressFile(File(widget.bean?.path ?? '')),
builder: (_, AsyncSnapshot<File?> s) {
if (!s.hasData) {
return Container();
}
return Image.file(fit: BoxFit.cover, s.data!);
},
);
}
///
Future<File> compressFile(File file) async {
File compressedFile = await FlutterNativeImage.compressImage(file.path,
quality: 30, percentage: 30, targetHeight: 100, targetWidth: 100);
return compressedFile;
}
https://pub.dev/packages/flutter_native_image
flutter_native_image: ^0.0.6+1