Agent.fromJson constructor

Agent.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Agent.fromJson(Map<String, dynamic> json) {
  return Agent(
    id: json['agent_id'] ?? '', // Provide default value if null
    name: json['name'] ?? '',
    description: json['description'] ?? '',
    type: json['type'] ?? '',
    isActive: json['is_active'] ,
    isDeployed: json['is_deployed'],
    is_published: json['is_published'],
    is_featured: json['is_featured'],
    agentConfigs: json['agent_configs'] != null
        ? AgentConfigs.fromJson(json['agent_configs'])
        : AgentConfigs(
      displayName: '',
      description: '', isSpeech2text: true, languages: [], customQuestions: [], colors: {},
    ), // Provide default `AgentConfigs` if null
  );
}