BarkoderResult.fromJson constructor

BarkoderResult.fromJson(
  1. Map<String, dynamic> resultMap
)

Implementation

BarkoderResult.fromJson(Map<String, dynamic> resultMap) {
  int barcodeTypeIndex = resultMap['barcodeType'];
  barcodeType = BarcodeType.fromInt(barcodeTypeIndex);
  barcodeTypeName = resultMap['barcodeTypeName'];
  binaryDataAsBase64 = resultMap['binaryDataAsBase64'];
  textualData = resultMap['textualData'];
  characterSet = resultMap['characterSet'];
  if (resultMap.containsKey('extra')) extra = json.decode(resultMap['extra']);
  resultImageAsBase64 = resultMap['resultImageAsBase64'];
  if (resultMap.containsKey('resultThumbnailsAsBase64')) {
    resultThumbnailsAsBase64 =
        List<String>.from(resultMap['resultThumbnailsAsBase64']);
  }
  if (resultMap.containsKey('mrzImagesAsBase64')) {
    mrzImagesAsBase64 = (resultMap['mrzImagesAsBase64'] as List<dynamic>)
        .map((imageData) => Map<String, String>.from(imageData))
        .toList();
  }
}