ShapeGeometry.fromJSON constructor

ShapeGeometry.fromJSON(
  1. Map<String, dynamic> json,
  2. Map<String, dynamic> rootJSON
)

Implementation

ShapeGeometry.fromJSON(
    Map<String, dynamic> json, Map<String, dynamic> rootJSON)
    : super.fromJSON(json, rootJSON) {
  curveSegments = json["curveSegments"];

  Shape? _shapes;

  if (json["shapes"] != null) {
    List<Shape> rootShapes = rootJSON["shapes"];

    String shapeUuid = json["shapes"];
    _shapes = rootShapes.firstWhere((element) => element.uuid == shapeUuid);
  }

  shapes = _shapes != null ? [_shapes] : [];

  init();
}