Slot.fromJson constructor

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

Implementation

factory Slot.fromJson(Map<String, dynamic> json) {
  return Slot(
    name: json['name'] as String,
    slotConstraint: (json['slotConstraint'] as String).toSlotConstraint(),
    defaultValueSpec: json['defaultValueSpec'] != null
        ? SlotDefaultValueSpec.fromJson(
            json['defaultValueSpec'] as Map<String, dynamic>)
        : null,
    description: json['description'] as String?,
    obfuscationSetting:
        (json['obfuscationSetting'] as String?)?.toObfuscationSetting(),
    priority: json['priority'] as int?,
    responseCard: json['responseCard'] as String?,
    sampleUtterances: (json['sampleUtterances'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    slotType: json['slotType'] as String?,
    slotTypeVersion: json['slotTypeVersion'] as String?,
    valueElicitationPrompt: json['valueElicitationPrompt'] != null
        ? Prompt.fromJson(
            json['valueElicitationPrompt'] as Map<String, dynamic>)
        : null,
  );
}