StepItem.fromMap constructor
Creates a StepItem from a map structure.
Expected format:
{"label": "Install", "status": "completed", "description": "..."}
Implementation
factory StepItem.fromMap(Map<String, dynamic> map) {
final statusStr = (map['status'] as String?) ?? 'pending';
final status = switch (statusStr) {
'active' => StepStatus.active,
'completed' => StepStatus.completed,
'error' => StepStatus.error,
'skipped' => StepStatus.skipped,
_ => StepStatus.pending,
};
return StepItem(
label: (map['label'] ?? '') as String,
status: status,
description: map['description'] as String?,
);
}