BarcodeSelectionSession.fromJSON constructor

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

Implementation

factory BarcodeSelectionSession.fromJSON(Map<String, dynamic> event) {
  var json = jsonDecode(event['session']);

  return BarcodeSelectionSession._(
    (json['newlySelectedBarcodes'] as List<dynamic>)
        .cast<Map<String, dynamic>>()
        .map((e) => Barcode.fromJSON(e))
        .toList()
        .cast<Barcode>(),
    (json['newlyUnselectedBarcodes'] as List<dynamic>)
        .cast<Map<String, dynamic>>()
        .map((e) => LocalizedOnlyBarcode.fromJSON(e))
        .toList()
        .cast<Barcode>(),
    (json['selectedBarcodes'] as List<dynamic>)
        .cast<Map<String, dynamic>>()
        .map((e) => LocalizedOnlyBarcode.fromJSON(e))
        .toList()
        .cast<Barcode>(),
    (json['frameSequenceId'] as num).toInt(),
    event['frameId'] as String?,
  );
}