DisplayItem.fromJson constructor

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

Implementation

factory DisplayItem.fromJson(Map<String, dynamic> json) {
  final type = json['type'] as String;
  switch (type) {
    case 'GlyphPath': return GlyphPathItem.fromJson(json);
    case 'Line':      return LineItem.fromJson(json);
    case 'Rect':      return RectItem.fromJson(json);
    case 'Path':      return PathItem.fromJson(json);
    default: throw FormatException('Unknown DisplayItem type: $type');
  }
}