From ef0534c643865aca678c8fb8ce23e5652af5dfc0 Mon Sep 17 00:00:00 2001 From: eggfly Date: Mon, 29 Nov 2021 15:34:07 +0800 Subject: [PATCH] Add a comment in Image.toByteData to limit more encoders --- lib/ui/painting.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index 33dcb8962575f..ca227397f1b51 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -1574,6 +1574,10 @@ class Paint { /// The format in which image bytes should be returned when using /// [Image.toByteData]. +// We do not expect to add more encoding formats to the ImageByteFormat enum, +// considering the binary size of the engine after LTO optimization. You can +// use the third-party pure dart image library to encode other formats. +// See: https://github.com/flutter/flutter/issues/16635 for more details. enum ImageByteFormat { /// Raw RGBA format. /// @@ -1715,6 +1719,10 @@ class Image { /// /// Returns a future that completes with the binary image data or an error /// if encoding fails. + // We do not expect to add more encoding formats to the ImageByteFormat enum, + // considering the binary size of the engine after LTO optimization. You can + // use the third-party pure dart image library to encode other formats. + // See: https://github.com/flutter/flutter/issues/16635 for more details. Future toByteData({ImageByteFormat format = ImageByteFormat.rawRgba}) { assert(!_disposed && !_image._disposed); return _image.toByteData(format: format);