getBarcodeGenerate method

Future<Uint8List> getBarcodeGenerate(
  1. String type,
  2. String text, {
  3. String? twoDDisplayText,
  4. String? textLocation,
  5. String? textAlignment,
  6. String? textColor,
  7. bool? noWrap,
  8. double? resolution,
  9. double? resolutionX,
  10. double? resolutionY,
  11. double? dimensionX,
  12. double? textSpace,
  13. String? units,
  14. String? sizeMode,
  15. double? barHeight,
  16. double? imageHeight,
  17. double? imageWidth,
  18. double? rotationAngle,
  19. String? backColor,
  20. String? barColor,
  21. String? borderColor,
  22. double? borderWidth,
  23. String? borderDashStyle,
  24. bool? borderVisible,
  25. String? enableChecksum,
  26. bool? enableEscape,
  27. bool? filledBars,
  28. bool? alwaysShowChecksum,
  29. double? wideNarrowRatio,
  30. bool? validateText,
  31. String? supplementData,
  32. double? supplementSpace,
  33. double? barWidthReduction,
  34. bool? useAntiAlias,
  35. String? format,
})

Generate barcode.

Implementation

Future<Uint8List> getBarcodeGenerate(String type, String text,
    {String? twoDDisplayText,
    String? textLocation,
    String? textAlignment,
    String? textColor,
    bool? noWrap,
    double? resolution,
    double? resolutionX,
    double? resolutionY,
    double? dimensionX,
    double? textSpace,
    String? units,
    String? sizeMode,
    double? barHeight,
    double? imageHeight,
    double? imageWidth,
    double? rotationAngle,
    String? backColor,
    String? barColor,
    String? borderColor,
    double? borderWidth,
    String? borderDashStyle,
    bool? borderVisible,
    String? enableChecksum,
    bool? enableEscape,
    bool? filledBars,
    bool? alwaysShowChecksum,
    double? wideNarrowRatio,
    bool? validateText,
    String? supplementData,
    double? supplementSpace,
    double? barWidthReduction,
    bool? useAntiAlias,
    String? format}) async {
  // ignore: prefer_final_locals
  Object? postBody;

  // create path and map variables
  final String requestPath =
      "/barcode/generate".replaceAll("{format}", "json");

  // query params
  final List<QueryParam> queryParams = [];
  final Map<String, String> headerParams = {};
  final Map<String, String> formParams = {};
  queryParams.addAll(convertParametersForCollectionFormat("", "Type", type));
  queryParams.addAll(convertParametersForCollectionFormat("", "Text", text));
  if (twoDDisplayText != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "TwoDDisplayText", twoDDisplayText));
  }
  if (textLocation != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "TextLocation", textLocation));
  }
  if (textAlignment != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "TextAlignment", textAlignment));
  }
  if (textColor != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "TextColor", textColor));
  }
  if (noWrap != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "NoWrap", noWrap));
  }
  if (resolution != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "Resolution", resolution));
  }
  if (resolutionX != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "ResolutionX", resolutionX));
  }
  if (resolutionY != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "ResolutionY", resolutionY));
  }
  if (dimensionX != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "DimensionX", dimensionX));
  }
  if (textSpace != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "TextSpace", textSpace));
  }
  if (units != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "Units", units));
  }
  if (sizeMode != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "SizeMode", sizeMode));
  }
  if (barHeight != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "BarHeight", barHeight));
  }
  if (imageHeight != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "ImageHeight", imageHeight));
  }
  if (imageWidth != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "ImageWidth", imageWidth));
  }
  if (rotationAngle != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "RotationAngle", rotationAngle));
  }
  if (backColor != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "BackColor", backColor));
  }
  if (barColor != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "BarColor", barColor));
  }
  if (borderColor != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "BorderColor", borderColor));
  }
  if (borderWidth != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "BorderWidth", borderWidth));
  }
  if (borderDashStyle != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "BorderDashStyle", borderDashStyle));
  }
  if (borderVisible != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "BorderVisible", borderVisible));
  }
  if (enableChecksum != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "EnableChecksum", enableChecksum));
  }
  if (enableEscape != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "EnableEscape", enableEscape));
  }
  if (filledBars != null) {
    queryParams.addAll(
        convertParametersForCollectionFormat("", "FilledBars", filledBars));
  }
  if (alwaysShowChecksum != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "AlwaysShowChecksum", alwaysShowChecksum));
  }
  if (wideNarrowRatio != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "WideNarrowRatio", wideNarrowRatio));
  }
  if (validateText != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "ValidateText", validateText));
  }
  if (supplementData != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "SupplementData", supplementData));
  }
  if (supplementSpace != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "SupplementSpace", supplementSpace));
  }
  if (barWidthReduction != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "BarWidthReduction", barWidthReduction));
  }
  if (useAntiAlias != null) {
    queryParams.addAll(convertParametersForCollectionFormat(
        "", "UseAntiAlias", useAntiAlias));
  }
  if (format != null) {
    queryParams
        .addAll(convertParametersForCollectionFormat("", "format", format));
  }

  final List<String> contentTypes = ["application/json"];

  final String contentType =
      contentTypes.isNotEmpty ? contentTypes[0] : "application/json";
  final List<String> authNames = ["JWT"];

  final response = await _apiClient.invokeAPI(requestPath, 'GET', queryParams,
      postBody, headerParams, formParams, contentType, authNames);

  if (response.statusCode >= 400) {
    throw ApiException(response.statusCode, response.body);
  } else {
    return response.bodyBytes;
  }
}