fromJson method

  1. @override
void fromJson(
  1. Map<String, dynamic> json
)
override

Deserializes JSON data into this annotation.

Implement this to update the annotation's properties from persisted data. This is called when loading saved workflows.

You typically update position, visibility, z-index, and any custom properties.

Implementation

@override
void fromJson(Map<String, dynamic> json) {
  final newPosition = Offset(
    (json['x'] as num).toDouble(),
    (json['y'] as num).toDouble(),
  );
  setPosition(newPosition);
  // Visual position will be set by controller with snapping
  setZIndex(json['zIndex'] as int? ?? 0);
  setVisible(json['isVisible'] as bool? ?? true);
  _dependencies.clear();
  _dependencies.addAll((json['dependencies'] as List?)?.cast<String>() ?? []);
}