PolylineAnnotation.fromJson constructor
PolylineAnnotation.fromJson(
- Map<String, dynamic> json
)
Implementation
factory PolylineAnnotation.fromJson(Map<String, dynamic> json) {
return PolylineAnnotation(
id: json['id'] as String?,
bbox: Annotation._toDoubleList(json['bbox'] as List),
createdAt: json['createdAt'] as String?,
pageIndex: json['pageIndex'] as int,
strokeColor: Annotation._hexToColor(json['strokeColor'] as String?),
strokeWidth: Annotation._toDouble(json['strokeWidth']),
points: (json['points'] as List)
.map((e) => Annotation._toDoubleList(e as List))
.toList(),
startStyle: json['startStyle'] as String?,
endStyle: json['endStyle'] as String?,
fillColor: Annotation._hexToColor(json['fillColor'] as String?),
borderStyle: json['borderStyle'] != null
? BorderStyle.values.firstWhere(
(e) => e.name == json['borderStyle'] as String,
orElse: () => BorderStyle.solid,
)
: null,
borderDashArray: json['borderDashArray'] != null
? Annotation._toDoubleList(json['borderDashArray'] as List<dynamic>)
: null,
cloudyBorderIntensity: json['cloudyBorderIntensity'] != null
? Annotation._toDouble(json['cloudyBorderIntensity'])
: null,
cloudyBorderInset: json['cloudyBorderInset'] is List<dynamic>
? Annotation._toDoubleList(json['cloudyBorderInset'] as List<dynamic>)
: null,
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,
note: json['note'] as String?, // Added to fromJson
measurementScale:
Annotation._parseMeasurementScale(json['measurementScale']),
measurementPrecision:
Annotation._parseMeasurementPrecision(json['measurementPrecision']),
measurementBBox: json['measurementBBox'] != null
? Annotation._toDoubleList(json['measurementBBox'] as List<dynamic>)
: null,
customData: json['customData'] != null
? Map<String, dynamic>.from(json['customData'])
: null,
);
}