CodeInterpreterResult.fromJson constructor

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

Implementation

factory CodeInterpreterResult.fromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'logs':
      return CodeInterpreterLogs(json['logs'] as String);
    case 'files':
      return CodeInterpreterFiles(
        (json['files'] as List).cast<Map<String, dynamic>>().map(CodeInterpreterResultFile.fromJson).toList(),
      );
    default:
      return CodeInterpreterResultOther(json);
  }
}