InkAnnotation.fromJson constructor

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

Implementation

factory InkAnnotation.fromJson(Map<String, dynamic> json) {
  return InkAnnotation(
    id: json['id'] as String?,
    lines: InkLines.fromJson(Map<String, dynamic>.from(json['lines'] as Map)),
    lineWidth: Annotation._toDouble(json['lineWidth']),
    isDrawnNaturally: json['isDrawnNaturally'] as bool? ?? false,
    isSignature: json['isSignature'] as bool?,
    strokeColor: Annotation._hexToColor(json['strokeColor'] as String?),
    backgroundColor:
        Annotation._hexToColor(json['backgroundColor'] as String?),
    blendMode: json['blendMode'] != null
        ? BlendMode.values.firstWhere(
            (e) => e.name == json['blendMode'] as String,
            orElse: () => BlendMode.normal,
          )
        : null,
    note: json['note'] as String?,
    bbox: Annotation._toDoubleList(json['bbox'] as List),
    createdAt: json['createdAt'] as String?,
    pageIndex: json['pageIndex'] as int,
    creatorName: json['creatorName'] as String?,
    opacity:
        json['opacity'] != null ? Annotation._toDouble(json['opacity']) : 1.0,
    pdfObjectId: json['pdfObjectId'] as int?,
    flags: Annotation._stringsToFlags(json['flags'] as List<dynamic>?),
    updatedAt: json['updatedAt'] as String?,
    name: json['name'] as String?,
    subject: json['subject'] as String?,
    hidden: json['hidden'] as bool? ?? false,
    customData: json['customData'] != null
        ? Map<String, dynamic>.from(json['customData'])
        : null,
  );
}