Skip to content

aspose-barcode-cloud/aspose-barcode-cloud-dart

Repository files navigation

Aspose.BarCode Cloud SDK for Dart

Dart test

  • API version: 4.0
  • SDK version: 4.25.1

SDK and API Version Compatibility:

  • SDK Version 4.25.1 and Later: Starting from SDK version 25.1, all subsequent versions are compatible with API Version v4.0.
  • SDK Version 1.24.12 and Earlier: These versions are compatible with API Version v3.0.

This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily

Demo applications

Scan QR Generate Barcode Recognize Barcode
ScanQR Generate Recognize
Generate Wi-Fi QR Embed Barcode Scan Barcode
Wi-FiQR Embed Scan

Aspose.BarCode for Cloud is a REST API for Linear, 2D and postal barcode generation and recognition in the cloud. API recognizes and generates barcode images in a variety of formats. Barcode REST API allows to specify barcode image attributes like image width, height, border style and output image format in order to customize the generation process. Developers can also specify the barcode type and text attributes such as text location and font styles in order to suit the application requirements.

This repository contains Aspose.BarCode Cloud SDK for Dart source code. This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Dart or Flutter applications quickly and easily.

To use these SDKs, you will need Client Id and Client Secret which can be looked up at Aspose Cloud Dashboard (free registration in Aspose Cloud is required for this).

Prerequisites

To use Aspose.BarCode Cloud SDK for Dart you need to register an account with Aspose Cloud and lookup/create Client Secret and SID at Cloud Dashboard. There is a free quota available. For more details, see Aspose Cloud Pricing.

Requirements

Dart 2.12.0 or later

Installation & Usage

Add this dependency to your pubspec.yaml:

dependencies:
  aspose_barcode_cloud: 4.25.1

Sample usage

Generate an image with barcode and then recognize it

The examples below show how you can generate QR barcode and save it into a local file and then recognize using aspose_barcode_cloud:

import 'dart:io';
import 'dart:typed_data';

import 'package:aspose_barcode_cloud/aspose_barcode_cloud.dart';

Future<void> main() async {
  const fileName = "qr.png";

  final client = ApiClient(Configuration(
    clientId: "Client Id from https://dashboard.aspose.cloud/applications",
    clientSecret:
        "Client Secret from https://dashboard.aspose.cloud/applications",
    // For testing only
    accessToken: Platform.environment["TEST_CONFIGURATION_ACCESS_TOKEN"],
  ));

  final genApi = GenerateApi(client);
  final scanApi = ScanApi(client);
  // Generate image with barcode
  final Uint8List generated =
      await genApi.generate(EncodeBarcodeType.QR, "text");

  // Save generated image to file
  File(fileName).writeAsBytesSync(generated);
  print("Generated image saved to '$fileName'");

  // Recognize generated image

  final BarcodeResponseList recognized = await scanApi.scanMultipart(generated);

  if (recognized.barcodes.isNotEmpty) {
    print("Recognized Type: ${recognized.barcodes[0].type!}");
    print("Recognized Value: ${recognized.barcodes[0].barcodeValue!}");
  } else {
    print("No barcode found");
  }
}

Dependencies

  • http: '>=0.13.0 <2.0.0'

Licensing

All Aspose.BarCode for Cloud SDKs, helper scripts and templates are licensed under MIT License.

Resources

Documentation for API Endpoints

All URIs are relative to https://api.aspose.cloud/v4.0

Class Method HTTP request Description
GenerateApi generate GET /barcode/generate/{barcodeType} Generate barcode using GET request with parameters in route and query string.
GenerateApi generateBody POST /barcode/generate-body Generate barcode using POST request with parameters in body in json or xml format.
GenerateApi generateMultipart POST /barcode/generate-multipart Generate barcode using POST request with parameters in multipart form.
RecognizeApi recognize GET /barcode/recognize Recognize barcode from file on server using GET requests with parameters in route and query string.
RecognizeApi recognizeBase64 POST /barcode/recognize-body Recognize barcode from file in request body using POST requests with parameters in body in json or xml format.
RecognizeApi recognizeMultipart POST /barcode/recognize-multipart Recognize barcode from file in request body using POST requests with parameters in multipart form.
ScanApi scan GET /barcode/scan Scan barcode from file on server using GET requests with parameter in query string.
ScanApi scanBase64 POST /barcode/scan-body Scan barcode from file in request body using POST requests with parameter in body in json or xml format.
ScanApi scanMultipart POST /barcode/scan-multipart Scan barcode from file in request body using POST requests with parameter in multipart form.

Documentation For Models