TextFormat.fromJson constructor

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

Implementation

factory TextFormat.fromJson(Map<String, dynamic> json) {
  switch (json['type']) {
    case 'text':
      return const TextFormatText();
    case 'json_object':
      return const TextFormatJsonObject();
    case 'json_schema':
      return TextFormatJsonSchema(
        name: json['name'] as String,
        schema: json['schema'],
        description: json['description'] as String?,
        strict: json['strict'] as bool?,
      );
    default:
      return TextFormatOther(json);
  }
}