butler_labs 0.0.1 copy "butler_labs: ^0.0.1" to clipboard
butler_labs: ^0.0.1 copied to clipboard

A Pure Dart SDK for Butler Labs OCR

Butler Labs OCR #

A Pure Dart SDK for Butler Labs OCR.

Supported Models #

Supported Endpoints #

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'),
),