toMap method

Map<String, dynamic> toMap()

Convert Decision to YAML-compatible Map

Implementation

Map<String, dynamic> toMap() {
  return {
    'id': id,
    'title': title,
    'reason': reason,
    if (alternatives.isNotEmpty) 'alternatives': alternatives,
    'createdAt': '${createdAt.year}-${createdAt.month.toString().padLeft(2, '0')}-${createdAt.day.toString().padLeft(2, '0')}',
    if (description != null) 'description': description,
    if (choice != null) 'choice': choice,
    if (detailFile != null) 'detail_file': detailFile,
  };
}