camera method

dynamic camera(
  1. BuildContext context
)

Implementation

camera(BuildContext context) async {
  final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
  if (photo != null) {
    // isImageSelected.value = true;
    // Get.to(CropImage(
    //   imageFile: File(photo.path),
    // ))?.then((value) {
    //   value as MemoryImage;
    //   // imageBytes = value.bytes;
    //   var name ="${DateTime.now().millisecondsSinceEpoch}.jpg";
    //   writeImageTemp(value.bytes, name).then((value) {
    //     imagePath(value.path);
    //   });
    // });

    if (context.mounted) {
      Navigator.push(
          context,
          MaterialPageRoute(
              builder: (con) => CropImage(
                    imageFile: File(photo.path),
                  ))).then((value) {
        value as MemoryImage;
        // imageBytes = value.bytes;
        var name = "${DateTime.now().millisecondsSinceEpoch}.jpg";
        writeImageTemp(value.bytes, name).then((value) {
          imagePath(value.path);
        });
      });
    }
  } else {
    // User canceled the Camera
    // isImageSelected.value = false;
  }
}