StickyAnnotation.fromJsonMap constructor

StickyAnnotation.fromJsonMap(
  1. Map<String, dynamic> json
)

Creates a StickyAnnotation from a JSON map.

This factory method is used during workflow deserialization to recreate sticky annotations from saved data.

Implementation

factory StickyAnnotation.fromJsonMap(Map<String, dynamic> json) {
  return StickyAnnotation(
    id: json['id'] as String,
    position: Offset(
      (json['x'] as num).toDouble(),
      (json['y'] as num).toDouble(),
    ),
    text: json['text'] as String? ?? '',
    width: (json['width'] as num?)?.toDouble() ?? 200.0,
    height: (json['height'] as num?)?.toDouble() ?? 100.0,
    color: Color(json['color'] as int? ?? Colors.yellow.toARGB32()),
    zIndex: json['zIndex'] as int? ?? 0,
    isVisible: json['isVisible'] as bool? ?? true,
    isInteractive: json['isInteractive'] as bool? ?? true,
    dependencies:
        (json['dependencies'] as List?)?.cast<String>().toSet() ?? {},
    offset: json['offsetX'] != null && json['offsetY'] != null
        ? Offset(
            (json['offsetX'] as num).toDouble(),
            (json['offsetY'] as num).toDouble(),
          )
        : Offset.zero,
    metadata: json['metadata'] as Map<String, dynamic>? ?? {},
  );
}