fromJson static method

BarcodeResult fromJson(
  1. Map json
)

Implementation

static BarcodeResult fromJson(Map<dynamic, dynamic> json) {
  String format = json['format'];

  int x1 = json['x1'];
  int y1 = json['y1'];
  int x2 = json['x2'];
  int y2 = json['y2'];
  int x3 = json['x3'];
  int y3 = json['y3'];
  int x4 = json['x4'];
  int y4 = json['y4'];
  int angle = json['angle'];
  List<Object?> lobjects = json['barcodeBytes'];
  List<int> lint = lobjects.map((e) => e as int).toList();
  Uint8List barcodeBytes = Uint8List.fromList(lint);

  String text = String.fromCharCodes(barcodeBytes);
  return BarcodeResult(
      format, text, x1, y1, x2, y2, x3, y3, x4, y4, angle, barcodeBytes);
}