fromJson static method
Create annotation from JSON
Implementation
static Annotation fromJson(Map<String, dynamic> json) {
final type = AnnotationType.values.firstWhere(
(e) => e.toString() == json['type'],
);
switch (type) {
case AnnotationType.drawing:
return DrawingAnnotation.fromJson(json);
case AnnotationType.note:
return NoteAnnotation.fromJson(json);
case AnnotationType.shape:
return ShapeAnnotation.fromJson(json);
case AnnotationType.highlight:
return HighlightAnnotation.fromJson(json);
}
}