There are several changes
- The return value of
File
is now changed to theXFile
type of cross_file, so you need to change the code toXFile
.
1.0:
final File file = FlutterImageCompress.compressAndGetFile(
file.absolute.path,
targetPath,
quality: 90,
minWidth: 1024,
minHeight: 1024,
rotate: 90,
);
int length = file.lengthSync();
Uint8List buffer = file.readAsBytesSync();
2.0:
final XFile file = await FlutterImageCompress.compressAndGetFile(
file.absolute.path,
targetPath,
quality: 90,
minWidth: 1024,
minHeight: 1024,
rotate: 90,
);
int length = await file.length();
Uint8List buffer = await file.readAsBytes();
Other usage of XFile
to see document