fromJson static method

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

Create annotation from JSON

Implementation

static ShapeAnnotation fromJson(Map<String, dynamic> json) {
  return ShapeAnnotation(
    id: json['id'],
    pageNumber: json['pageNumber'],
    createdAt: DateTime.parse(json['createdAt']),
    modifiedAt: DateTime.parse(json['modifiedAt']),
    shapeType: ShapeType.values.firstWhere(
      (e) => e.toString() == json['shapeType'],
    ),
    bounds: Rect.fromLTRB(
      json['bounds'][0].toDouble(),
      json['bounds'][1].toDouble(),
      json['bounds'][2].toDouble(),
      json['bounds'][3].toDouble(),
    ),
    color: Color(json['color']),
    strokeWidth: json['strokeWidth'].toDouble(),
    filled: json['filled'],
    fillColor: json['fillColor'] != null ? Color(json['fillColor']) : null,
  );
}