Butler Labs OCR

A Pure Dart SDK for Butler Labs OCR.

Supported Models

US Driver's License

Passport

Receipt

Invoice

ID Card

W2

W9

Mortgage

Health Insurance Card

Paystub

Tables are not supported yet

Supported Endpoints

Extract Document

Get Enhanced Extraction Results

🔲 Upload Documents

🔲 Get Extraction Results

🔲 Delete Upload

🔲 Create Model

🔲 Get Model Info

🔲 Train Model

🔲 Update Labels for a Document

🔲 Get Bank Statement Results

Usage

See blog post for setup and usage instructions.

ElevatedButton(
  onPressed: () async {
    license.value = null;
    ImagePicker picker = ImagePicker();

    XFile? pickedImage = await picker.pickImage(source: ImageSource.gallery);

    if (pickedImage == null) return;

    Uint8List imageBytes = await pickedImage.readAsBytes();

    // You can use the ButlerResult class
    ButlerResult? output = await ButlerLabs(const String.fromEnvironment('BUTLER_API_KEY')).performOcrOnImageBytes(
      imageBytes: imageBytes,
      queueId: Model.driversLicense.id,
    );

    if (output != null) {
      license.value = DriversLicense.fromButlerResult(output);
    }

    // Or you can use the map method
    /*Map<String, dynamic>? output = await ButlerLabs(const String.fromEnvironment('BUTLER_API_KEY')).performOcrOnImage(
      imageBytes: imageBytes,
      queueId: Model.driversLicense.id,
    );

    if (output != null) {
      license.value = DriversLicense.fromJson(output);
    }*/
  },
  child: const Text('Upload Image'),
),