CPDFReplyAnnotation.fromJson constructor

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

Implementation

factory CPDFReplyAnnotation.fromJson(Map<String, dynamic> json) {
  CPDFAnnotationType type = CPDFAnnotationType.unknown;
  final typeValue = json['type'];
  if (typeValue is String) {
    try {
      type = CPDFAnnotationType.fromString(typeValue);
    } catch (_) {
      type = CPDFAnnotationType.unknown;
    }
  }

  return CPDFReplyAnnotation(
    type: type,
    title: json['title'] ?? '',
    page: json['page'] ?? 0,
    content: json['content'] ?? '',
    uuid: json['uuid'] ?? '',
    createDate: json['createDate'] != null
        ? DateTime.fromMillisecondsSinceEpoch(json['createDate'])
        : null,
    modifyDate: json['modifyDate'] != null
        ? DateTime.fromMillisecondsSinceEpoch(json['modifyDate'])
        : null,
    markState:
        CPDFAnnotationMarkState.fromString(json['markState'] as String?),
    reviewState:
        CPDFAnnotationReviewState.fromString(json['reviewState'] as String?),
    rect: CPDFRectF.fromJson(Map<String, dynamic>.from(json['rect'] ?? {})),
  );
}