PdfTrustResolutionBySignature.fromJson constructor

PdfTrustResolutionBySignature.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory PdfTrustResolutionBySignature.fromJson(Map<String, dynamic> json) {
  final trustedMap = <String, bool>{};
  final rawMap = json['trustedByProfile'];
  if (rawMap is Map) {
    rawMap.forEach((key, value) {
      trustedMap[key.toString()] = value == true;
    });
  }
  final reasons = (json['reasons'] as List<dynamic>? ?? const <dynamic>[])
      .map((e) => e.toString())
      .toList(growable: false);
  return PdfTrustResolutionBySignature(
    signatureIndex: (json['signatureIndex'] as num?)?.toInt() ?? 0,
    fieldName: (json['fieldName'] ?? 'Signature').toString(),
    trustedByProfile: trustedMap,
    winningProfile: json['winningProfile']?.toString(),
    reasons: reasons,
  );
}