我有这样一个场景,我必须从这样的图像中获取UInt8List:
List stuff = image.toByteData().buffer.asUInt8List()
执行一些操作,然后返回到Image。
我尝试过以下几种方法:
List stuff = image.toByteData().buffer.asUInt8List()
ui.decodeImageFromList(stuff, (image){
// do stuff with image
});
但我一直收到这样的异常:
E/flutter (10201): [ERROR:flutter/lib/ui/painting/codec.cc(97)] Failed decoding image. Data is either invalid, or it is encoded using an unsupported format.
E/flutter (10201): [ERROR:flutter/shell/common/shell.cc(186)] Dart Error: Unhandled exception:
...
请注意,即使列表中没有任何更改,也会抛出异常。如何才能使列表具有可编码的格式?
https://stackoverflow.com/questions/54030340
复制相似问题