captureImage method

dynamic captureImage()

Implementation

captureImage() async {
  try {
    final image = await _controller!.takePicture();

    if (!mounted) return '';
    final bytes = File(image.path).readAsBytesSync();
    String base64Image = base64Encode(bytes);

    return base64Image;
  } catch (e) {
    if (kDebugMode) {
      print(e);
    }
    return '0';
  }
}