PassBarcode.fromJson constructor

PassBarcode.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory PassBarcode.fromJson(Map<String, Object?> json) {
  final messageEncoding =
      supportedCodecs[(json['messageEncoding'] as String).toLowerCase()]!;
  return PassBarcode(
    format: _allowedFormats[json['format']]!,
    barcodeData:
        Uint8List.fromList(messageEncoding.encode(json['message'] as String)),
    messageEncoding: messageEncoding,
    altText: json['altText'] as String?,
  );
}