将图像格式转换为字节格式

问题描述 投票:1回答:1

如何使用flutter on_click按钮获取字节格式的图像,以及如何在任何设备上的图库中存储图像请帮助解决这个问题。

  onPressed: () {
    isVideo = false;
    _onImageButtonPressed(ImageSource.camera);
  }
flutter
1个回答
0
投票

这应该得到字节:

  onImageButtonPressed(Future<File> futureFile) {
    var file = await futureFile;
    var bytes = file.readAsBytesSync();
  }
© www.soinside.com 2019 - 2024. All rights reserved.