AgentConfigs.fromJson constructor
AgentConfigs.fromJson(
- Map<String, dynamic> json
)
Implementation
factory AgentConfigs.fromJson(Map<String, dynamic> json) {
return AgentConfigs(
displayName: json['display_name'] ?? '', // Default to empty string if null
description: json['description'] ?? '',
image: json['image'], // Nullable field
fileConfig: json.containsKey('file_config')
? FileConfig.fromJson(json['file_config'])
: null,
customQuestions: json['custom_questions'] != null
? List<dynamic>.from(json['custom_questions'])
: [], // Default to empty list if not present
isSpeech2text: json['is_speech2text'] ?? false,
languages: json['languages'] != null
? List<String>.from(json['languages'])
: [], // Default to empty list if not present
colors: json['colors'] != null
? Map<String, dynamic>.from(json['colors'])
: {}, // Default to empty map if not present
voice_code: json['voice_code'] ?? '',
);
}