fromJson static method

PathSource fromJson(
  1. Map<String, Object?> json
)

Implementation

static PathSource fromJson(Map<String, Object?> json) {
  final k = json['kind'];
  switch (k) {
    case 'polyline':
      return PolylineSource.fromJson(json);
    case 'rect':
      return RectSource.fromJson(json);
    case 'roundRect':
      return RoundRectSource.fromJson(json);
    case 'pill':
      return PillSource.fromJson(json);
    case 'underline':
      return UnderlineSource.fromJson(json);
    case 'ellipse':
      return EllipseSource.fromJson(json);
    case 'svg':
      return SvgPathSource.fromJson(json);
    case 'circle':
      return CircleSource.fromJson(json);
    case 'regularPolygon':
      return RegularPolygonSource.fromJson(json);
    case 'star':
      return StarSource.fromJson(json);
    default:
      throw FormatException('Unknown PathSource kind: $k');
  }
}