1. Flutter
  2. AI Scanning APIs

Flutter

AI Scanning APIs

The Vision SDK supports OCR via cloud-based APIs to extract structured data from various documents like shipping labels, BOLs (Bill of Lading), and item labels. This mode leverages RESTful APIs and requires a valid API key or token and environment to be configured before making any calls. All you need to do is, capture the image of a document and then send it to relevant API.

📌 You can obtain your API key and environment details from cloud.packagex.io.

Learn how to capture an image using Vision SDK.

☁️ Cloud-based APIs

The Vision SDK cloud OCR supports the following document types:

  • Shipping Labels (SL)
  • Bill of Lading (BOL)
  • Item Label (IL)

Let's get deep into our cloud-based APIs.

📦 Shipping Labels ( SL )

Extracts structured data such as tracking numbers, courier names, addresses, etc. More details Here

To get logistic information from a shipping label, call the following method:

        class VisionSDKStatelessWidget extends StatelessWidget {
  const VisionSDKStatelessWidget({super.key, required this.listener});

  final PluginToFlutterCommunicator listener;

  @override
  Widget build(BuildContext context) {
    return VisionCameraWidget(
      listener: listener,
      onViewCreated: (FlutterToPluginCommunicator sender) {
        sender.callShippingLabelApi(
          {String? apiKey,
          String? token,
          required Uint8List image,
          bool shouldResizeImage = true,
          required List<String> barcodes,
          String? locationId,
          Map<String, dynamic>? recipient,
          Map<String, dynamic>? sender,
          Map<String, dynamic>? options,
          Map<String, dynamic>? metadata});
      },
    );
  }
}

class Listener implements PluginToFlutterCommunicator {
  @override
  void onOnlineSLResult(Map<String, dynamic> result) {
    
  }
}

      

🔍 Parameter Breakdown

Parameter Description
apiKey (Optional) API key for authenticating the request.
token (Optional) Bearer token for authenticated sessions (used as an alternative to apiKey).
image The Uint8List of captured image of the shipping label to be scanned.
shouldResizeImage (Optional) Boolean flag to control if the image should be resized before upload. Default is true.
barcodes A list of string barcode values (if detected beforehand) to include in the OCR request.
locationId (Optional) Location identifier where the scan is being performed. Leave null if not applicable.
recipient (Optional)
sender (Optional)
options (Optional) Additional settings to control scanning behavior. You can learn more here: Shipping Label Inference Options.
metaData (Optional) A dictionary of key-value pairs to associate custom metadata with the scan.

📄 Bill of Lading ( BOL )

Detects and extracts BOL-specific fields such as carrier information, consignee details, and reference numbers. More details Here

To get logistic information from a bill of lading, call the following method:

        class VisionSDKStatelessWidget extends StatelessWidget {
  const VisionSDKStatelessWidget({super.key, required this.listener});

  final PluginToFlutterCommunicator listener;

  @override
  Widget build(BuildContext context) {
    return VisionCameraWidget(
      listener: listener,
      onViewCreated: (FlutterToPluginCommunicator sender) {
        sender.callBolApi(
          {String? apiKey,
          String? token,
          required Uint8List image,
          bool shouldResizeImage = true,
          required List<String> barcodes,
          String? locationId,
          Map<String, dynamic>? options,});
      },
    );
  }
}

class Listener implements PluginToFlutterCommunicator {
  @override
  void onOnlineBOLResult(Map<String, dynamic> result) {
    
  }
}

      

🔍 Parameter Breakdown

Parameter Description
apiKey (Optional) API key for authenticating the request.
token (Optional) Bearer token for authenticated sessions (used as an alternative to apiKey).
image The Uint8List of captured image of the bill of lading to be scanned.
shouldResizeImage (Optional) Boolean flag to control if the image should be resized before upload. Default is true.
barcodes A list of string barcode values (if detected beforehand) to include in the OCR request.
locationId (Optional) Location identifier where the scan is being performed. Leave null if not applicable.
options (Optional) Additional settings to control scanning behavior. You can learn more here: Bill of Lading Inference Options.

🏷️ Item Labels

Recognizes SKU, GTIN, price, brand, and other item-level information printed on labels. More details Here

To get logistic information from an item label, call the following method:

        class VisionSDKStatelessWidget extends StatelessWidget {
  const VisionSDKStatelessWidget({super.key, required this.listener});

  final PluginToFlutterCommunicator listener;

  @override
  Widget build(BuildContext context) {
    return VisionCameraWidget(
      listener: listener,
      onViewCreated: (FlutterToPluginCommunicator sender) {
        sender.callItemLabelApi(
          {String? apiKey,
            String? token,
            required Uint8List image,
            bool shouldResizeImage = true,});
      },
    );
  }
}

class Listener implements PluginToFlutterCommunicator {
  @override
  void onOnlineItemLabelResult(Map<String, dynamic> result) {
    
  }
}

      

🔍 Parameter Breakdown

Parameter Description
apiKey (Optional) API key for authenticating the request.
token (Optional) Bearer token for authenticated sessions (used as an alternative to apiKey).
image The Uint8List of captured image of the item label to be scanned.
shouldResizeImage (Optional) Boolean flag to control if the image should be resized before upload. Default is true.