BarcodeCountSession.fromJSON constructor

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

Implementation

factory BarcodeCountSession.fromJSON(Map<String, dynamic> event) {
  final json = jsonDecode(event['session']);
  final frameSequenceId = json['frameSequenceId'] as int;
  final trackedCodes = (json['recognizedBarcodes'] as List).map((e) => Barcode.fromJSON(e)).toList();
  final additionalBarcodes = (json['additionalBarcodes'] as List<dynamic>)
      .cast<Map<String, dynamic>>()
      .map((e) => Barcode.fromJSON(e))
      .toList()
      .cast<Barcode>();
  final frameId = event['frameId'] as String;

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