BarcodeCountSession.fromJSON constructor

BarcodeCountSession.fromJSON(
  1. Map<String, dynamic> json
)

Implementation

factory BarcodeCountSession.fromJSON(Map<String, dynamic> json) {
  var frameSequenceId = json['frameSequenceId'] as int;
  var trackedCodes = (json['recognizedBarcodes'] as Map)
      .cast<String, Map<String, dynamic>>()
      .map<int, TrackedBarcode>((key, value) =>
          MapEntry(int.parse(key), TrackedBarcode.fromJSON(value, sessionFrameSequenceId: frameSequenceId)));
  var additionalBarcodes = (json['additionalBarcodes'] as List<dynamic>)
      .cast<Map<String, dynamic>>()
      .map((e) => Barcode.fromJSON(e))
      .toList()
      .cast<Barcode>();

  return BarcodeCountSession._(trackedCodes, additionalBarcodes, frameSequenceId);
}