小编abd*_*lik的帖子

如何使用 dart 将 Uint8list 转换为 List<int>?

我开发了一个带有颤振的移动应用程序。我做对象检测使用“controller.startImageStream”这个方法返回CameraImage,我使用对象检测。我想保存这个图像文件。我试图将此文件转换为 List 和 jpg 文件以进行保存。但是 uint8list 无法转换为 List。这种结构是真的吗?如果您知道我的问题的不同解决方案,请与我分享。

这是我的视频流方法;

startVideoStreaming() {
    if (cameras == null || cameras.length < 1) {
      print('No camera is found');
    } else {
      controller = new CameraController(
        cameras[0],
          ResolutionPreset.medium,
        );

        if(!_busy){
          controller.initialize().then((_) {

          print("model yükleme bitmi? stream dinleme ba?l?yor ");

          controller.startImageStream((CameraImage img){
                  print("img format: ${img.format} planes: ${img.planes}");
                  List<int> imageBytes = [];
                  img.planes.map((plane) {
                    imageBytes.addAll(plane.bytes.toList());
                  });
                  
                  // call save image file method
                    saveImageFile(imageBytes).then((res) => {
                      print("save image file successfull filepath: $res")
                    }).catchError((err) => {
                      print("error on save …
Run Code Online (Sandbox Code Playgroud)

typeconverter dart flutter uint8list

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

dart ×1

flutter ×1

typeconverter ×1

uint8list ×1