簡體   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

code是:

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

相同的代碼在不同的項目中運行良好,但是每當我將其實施到現有的項目中時都會error

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

在代碼的第 4 行,粗體文本 *路徑

當我從那里刪除**路徑時,觸發 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.

請幫忙。 對不起,我的英語不好。

由於版本 0.6.x takePicture 沒有參數。 如果您想使用最新的插件版本運行它,請查看當前示例。

參閱以獲取更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM