VerificationResultMessage.fromJson constructor

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

Implementation

factory VerificationResultMessage.fromJson(Map<String, dynamic> json) {
  final rawEvidence = json['evidence'] as List? ?? const [];
  return VerificationResultMessage(
    missionId: json['mission_id'] as String,
    stepIndex: json['step_index'] as int,
    success: json['success'] as bool,
    evidence: [
      for (final e in rawEvidence)
        VerificationEvidenceCodec.fromWire(e as String)
    ],
    timestamp: DateTime.parse(json['timestamp'] as String),
    failureReason: json['failure_reason'] as String?,
    value: json['value'] is String ? json['value'] as String : null,
    strategy: json['strategy'] is String ? json['strategy'] as String : null,
    requestedStableId: _str(json['requested_stable_id']),
    requestedText: _str(json['requested_text']),
    actedStableId: _str(json['acted_stable_id']),
    actedRole: _str(json['acted_role']),
    redirected: json['redirected'] is bool ? json['redirected'] as bool : null,
    matchSource: _str(json['match_source']),
    verified: json['verified'] is bool ? json['verified'] as bool : null,
    valueMatched:
        json['value_matched'] is bool ? json['value_matched'] as bool : null,
  );
}