当前位置:网站首页>flutter Uint8List格式的图片和File格式图片的互相转换
flutter Uint8List格式的图片和File格式图片的互相转换
2022-07-01 10:41:00 【氤氲息】
file格式图片转成Uint8List格式的图片
Uint8List imageByte;
imageByte = await widget.image.readAsBytes();
//将回调拿到的Uint8List格式的图片转换为File格式
SaveImage(Uint8List imageByte) async {
//获取临时目录
var tempDir = await getTemporaryDirectory();
//生成file文件格式
var file =
await File('${
tempDir.path}/image_${
DateTime.now().millisecond}.jpg')
.create();
//转成file文件
file.writeAsBytesSync(imageByte);
print("${file.path}");
setState(() {
path = file.path;
// turn(file);
_imageUint8=imageByte;
});
}
边栏推荐
- Zero foundation software testing must see, 10 years of testing old bird's conscience suggestions (a total of 15)
- 使用强大的DBPack处理分布式事务(PHP使用教程)
- 12. Gateway new generation gateway
- About database: how to avoid deadlock in gbase 8s
- Can MySQL CDC take out the op field
- 客户端如何请求数据库?
- Detailed explanation of linear regression in machine learning
- [paper reading] trajectory guided control prediction for end to end autonomous driving: a simple yet strong Ba
- Handling distributed transactions with powerful dbpack (PHP tutorial)
- Japanese professor sues Intel FPGA and SOC products for infringing a design patent
猜你喜欢

What legal risks and qualifications should be paid attention to when building a digital collection platform?

The list of winners of the digital collection of "century master" was announced

Introduction of uniapp wechat applet components on demand

零基础入门测试该学什么?最全整理,照着学就对了

《百年巨匠》数字藏品中奖名单公布

Suggest collecting | what to do when encountering slow SQL on opengauss?

Wireshark TS | 快速重传和乱序之混淆

数字藏品市场新局面

中国探月工程独家藏品限量发售!

106. construct binary tree from middle order and post order traversal sequence
随机推荐
在通达信上买基金安全吗?
数据库的增删改查问题
投稿开奖丨轻量应用服务器征文活动(5月)奖励公布
内存泄漏定位工具之 valgrind 使用
关于#SQL#的问题,如何解决?
数字藏品平台搭建需要注意哪些法律风险及资质?
Common penetration tools -goby
[matytype] insert MathType inter line and intra line formulas in CSDN blog
12. Gateway new generation gateway
Button button clear border
CRC 校驗
Design and practice of new generation cloud native database
Programmers want to go to state-owned enterprises? The technology is backward and the salary is low. I can't find a job after lying flat for several years
SQL server2014 failed to delete the database, with an error offset of 0x0000
MySQL common commands
bash: ln: command not found
推荐一款 JSON 可视化工具神器!
问下群里的各位,有使用flink oracle cdc的logminer方案,在生产上稳定运行的实际
Simulink simulation circuit model of open loop buck buck buck chopper circuit based on MATLAB
建议收藏 | 在openGauss上遇到慢SQL该怎么办?