PCanvasElement2D.fromJson constructor

PCanvasElement2D.fromJson(
  1. Map<String, dynamic> j
)

Implementation

factory PCanvasElement2D.fromJson(Map<String, dynamic> j) {
  var className = j['className'];

  switch (className) {
    case 'PCanvasPanel2D':
      return PCanvasPanel2D.fromJson(j);
    case 'PCanvasGridPanel2D':
      return PCanvasGridPanel2D.fromJson(j);
    default:
      throw StateError("Can't handle JSON with `className`: $className");
  }
}