MPFlutterImageEncoder class

Constructors

MPFlutterImageEncoder()

Properties

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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

encodeToBase64({required Image image, MPFlutterImageByteFormat format = MPFlutterImageByteFormat.png, double compressQuality = 0.92}) Future<String?>
保存 Image 成 Base64 字符串
encodeToBytes({required Image image, MPFlutterImageByteFormat format = MPFlutterImageByteFormat.png, double compressQuality = 0.92}) Future<ByteData?>
不建议使用该方法,该方法使用 base64.decode 会导致严重卡顿。 建议使用 encodeToFilePath 或 encodeToBase64
encodeToFilePath({required Image image, required String filePath, MPFlutterImageByteFormat format = MPFlutterImageByteFormat.png, double compressQuality = 0.92}) Future<String>
直接将 Image 保存成小程序文件,然后你可以使用 WX API 上传到服务器,或使用 WX API 保存到用户相册。