Cunning Document Scanner not Working on IOS

Custom Code

I am trying to use the cunning document scanner available on pub.dev here:

cunning_document_scanner | Flutter package (pub.dev)

I have created a custom action that works great on android however it doesn't seem to do anything on IOS.

Any Ideas on what I can do to get this working on IOS?

This is my current custom action:

import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:cunning_document_scanner/cunning_document_scanner.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pdfWidgets;
import 'dart:io';
import 'dart:typed_data';

Future<String> invoicescanner() async {
  // Initialize Firebase
  await Firebase.initializeApp();

  // Scan document using cunning document scanner
  final List<String>? imagePaths = await CunningDocumentScanner.getPictures();

  // Ensure imagePaths is not null and contains at least one image
  if (imagePaths == null || imagePaths.isEmpty) {
    throw Exception('No images scanned');
  }

  // Create a PDF document
  final pdfDocument = pdfWidgets.Document();

  // Convert image paths to PDF pages
  for (String path in imagePaths) {
    File imageFile = File(path);
    if (imageFile.existsSync()) {
      // Add image to PDF page
      pdfDocument.addPage(
        pdfWidgets.Page(
          build: (context) {
            return pdfWidgets.Image(
              pdfWidgets.MemoryImage(
                imageFile.readAsBytesSync(),
              ),
            );
          },
        ),
      );
    }
  }

  // Convert PDF document to bytes
  final Uint8List pdfBytes = await pdfDocument.save();

  // Upload PDF to Firebase Storage
  final storageRef = FirebaseStorage.instance
      .ref()
      .child('scanned_images/${DateTime.now().millisecondsSinceEpoch}.pdf');
  final uploadTask = storageRef.putData(pdfBytes);

  // Get download URL of uploaded PDF
  final downloadUrl = await (await uploadTask).ref.getDownloadURL();

  // Return download URL
  return downloadUrl.toString();
}
What have you tried so far?

I have made sure permissions to the camera and gallery are set in the IOS app. I can access the camera but not the document scanner.

Did you check FlutterFlow's Documentation for this topic?
Yes
14 replies