Flutter Shows path error on take picture function

57 Views Asked by At

I write some code to take picture and saved in getTemporaryDirectory() path variable but wheni initalize the path on _cameraController.takePicture(path); it shows me error of

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

    await _cameraController.takePicture(path);

i dont get which arguments is this talking about on path variable please someone help me out with this error

Here is my code for taking picture:-

void takePhoto(BuildContext context) async{

final path = join((await getTemporaryDirectory()).path,"${DateTime.now()}.png");

  await _cameraController.takePicture(path);

  Navigator.push(context, MaterialPageRoute(builder: (builder)=>CameraViewPage()));

}

this function will show me an error on await _cameraController.takePicture(path); line on path for Too many positional arguments: 0 allowed

does anyone know about this error?

Please help me,

Thank You.

1

There are 1 best solutions below

0
On

This method don't have parameters.

Future<XFile> takePicture()