我试图在数据库中存储图像,方法是将图像转换为Uint8List,然后以颤振方式显示图像,我尝试将Uint8List存储为文本和VARCHAR,并且具有Uint8List和got字符串类型的错误期望值。
addimage(String x , Uint8List img)async{
print (x);
var url = 'http://ip/imageStore.php';
var response = await http.post(Uri.parse(url), body :{
'word': x,
'imageByte': img,
});
snapshot.data![index]['imageByte'] as Uint8List发布于 2022-11-16 21:25:48
我通过使用base64编码和解码来修正它,然后将编码的图像存储在mysql中,当我想显示我的图像时,我使用了image.memory。
image = base64Encode(Uint8List_image); // convert image to base64 (String);
image.memory(base64Decode(image)); // convert encoded image to Uint8List and display it ;https://stackoverflow.com/questions/74466701
复制相似问题