AnnotationProperties.fromJson constructor

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

Creates AnnotationProperties from a JSON map.

Implementation

factory AnnotationProperties.fromJson(Map<String, dynamic> json) {
  return AnnotationProperties(
    annotationId: json['annotationId'] as String?,
    pageIndex: json['pageIndex'] as int?,
    strokeColor: _parseColor(json['strokeColor']),
    fillColor: _parseColor(json['fillColor']),
    opacity: (json['opacity'] as num?)?.toDouble(),
    lineWidth: (json['lineWidth'] as num?)?.toDouble(),
    flagsJson: _readFlags(json),
    // The model carries custom data as a JSON *string* (`customDataJson`),
    // but InstantJSON and the Web SDK key it as `customData` (an object).
    // Accept either: a pre-encoded `customDataJson` string, or a
    // `customData` object that we encode to a string here.
    customDataJson: _readCustomData(json),
    contents: json['contents'] as String?,
    subject: json['subject'] as String?,
    creator: json['creator'] as String?,
    bboxJson: json['bboxJson'] as String?,
    note: json['note'] as String?,
    inkLinesJson: json['inkLinesJson'] as String?,
    fontName: json['fontName'] as String?,
    fontSize: (json['fontSize'] as num?)?.toDouble(),
    iconName: json['iconName'] as String?,
  );
}