简体   繁体   English

在 flutter 中使用相机 package 没有点击和预览图片

[英]Using camera package in flutter not getting picture clicked and preview

The camera package I am using is: camera: git: url: https://github.com/flutter/plugins.git path: packages/camera/camera ref: cfa709835ab85702ee8a9ed24bbe7a3fe736c3f5 The camera package I am using is: camera: git: url: https://github.com/flutter/plugins.git path: packages/camera/camera ref: cfa709835ab85702ee8a9ed24bbe7a3fe736c3f5

The code is: code是:

try {
     final path =
      join((await getTemporaryDirectory()).path, '${DateTime.now()}.png');
      await controller.takePicture(**path**); 
       Navigator.push(
        context,
         MaterialPageRoute(
          builder: (context) => PreviewScreen(
           imgPath: path,
                   )),
                 );

Same code is working fine in different project but whenever I am implementing it to existing one getting error :相同的代码在不同的项目中运行良好,但是每当我将其实施到现有的项目中时都会error

Too many positional arguments: 0 expected, but 1 found.  Try removing the extra argument.

on line number 4 of code, the bold text * path在代码的第 4 行,粗体文本 *路径

When I am removing the **path from there, The console output after triggering function is:当我从那里删除**路径时,触发 function 后的控制台 output 是:

 console output: I/flutter (13243): Error:Previous capture has not returned yet.
I/flutter (13243): Error message : takePicture was called before the previous capture returned.
I/flutter (13243): Error:Previous capture has not returned yet.
I/flutter (13243): Error message : takePicture was called before the previous capture returned.

Please help.请帮忙。 Sorry for my bad English.对不起,我的英语不好。

Since version 0.6.x takePicture has no parameter.由于版本 0.6.x takePicture 没有参数。 If you want to run it with the latest plugin version, take a look at the current example.如果您想使用最新的插件版本运行它,请查看当前示例。

Please, refer for more information.参阅以获取更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM