onShot method

Future<bool> onShot()

Implementation

Future<bool> onShot() async {
  if(countbling>6){
  if (!_faceDetectorService.faceDetected) {
    showDialog(
      context: context,
      builder: (context) {
        return const AlertDialog(
          content: Text('No face detected!'),
        );
      },
    );

    return false;
  } else {
    await Future.delayed(const Duration(milliseconds: 500));
    // await _cameraService.cameraController?.stopImageStream();
    await Future.delayed(const Duration(milliseconds: 200));
    XFile? file = await _cameraService.takePicture();
    // uploadData(file!);
    imagePath = file?.path;

    setState(() {
      pictureTaken = true;
    });

    return true;
  }
  }else{

    Fluttertoast.showToast(msg: "blink your eyes 4 5 times",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER);
    return false;
  }
}