FlutterImageCompressCommon class

Image Compress plugin.

Method in the static class will help you to compress images, most methods will return Uint8List.

You can use Image.memory to display image:

Uint8List uint8List;
ImageProvider provider = MemoryImage(uint8List);

or

Uint8List uint8List;
Image.memory(uint8List)

The returned image will retain the proportion of the original image. Compress image will remove its EXIF info. and the result is in jpeg format. Rotation is also supported.

Inheritance
  • Object
  • PlatformInterface
  • FlutterImageCompressPlatform
  • FlutterImageCompressCommon

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
validator → FlutterImageCompressValidator
no setteroverride

Methods

compressAndGetFile(String path, String targetPath, {int minWidth = 1920, int minHeight = 1080, int inSampleSize = 1, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false, int numberOfRetries = 5}) → Future<XFile?>
override
compressAssetImage(String assetName, {int minWidth = 1920, int minHeight = 1080, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false}) → Future<Uint8List?>
override
compressWithFile(String path, {int minWidth = 1920, int minHeight = 1080, int inSampleSize = 1, int quality = 95, int rotate = 0, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false, int numberOfRetries = 5}) → Future<Uint8List?>
override
compressWithList(Uint8List image, {int minWidth = 1920, int minHeight = 1080, int quality = 95, int rotate = 0, int inSampleSize = 1, bool autoCorrectionAngle = true, CompressFormat format = CompressFormat.jpeg, bool keepExif = false}) → Future<Uint8List>
override
ignoreCheckSupportPlatform(bool value) → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showNativeLog(bool value) → Future<void>
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

registerWith() → void
For flutter plugin registration.