// import 'dart:io';
//
// import 'package:get/get.dart';
// import 'package:image_picker/image_picker.dart';
// import 'package:google_ml_kit/google_ml_kit.dart';
//
// class ImagePickerController extends GetxController {
//   RxBool textScanning = false.obs;
//   RxString scannedText = ''.obs;
//
//   Future<void> getImage(ImageSource source) async {
//     try {
//       final pickedImage = await ImagePicker().pickImage(source: source);
//       if (pickedImage != null) {
//         textScanning.value = true;
//         final imageFile = File(pickedImage.path);
//         getRecognisedText(imageFile);
//       }
//     } catch (e) {
//       textScanning.value = false;
//       scannedText.value = "Error occurred while scanning";
//     }
//   }
//
//   Future<void> getRecognisedText(File image) async {
//     final inputImage = InputImage.fromFilePath(image.path);
//     final textDetector = GoogleMlKit.vision.textRecognizer();
//     final RecognizedText recognisedText =
//         await textDetector.processImage(inputImage);
//     await textDetector.close();
//
//     scannedText.value = '';
//     for (TextBlock block in recognisedText.blocks) {
//       for (TextLine line in block.lines) {
//         scannedText.value += line.text + '\n';
//       }
//     }
//
//     textScanning.value = false;
//   }
// }
