FormatConfig.fromJson constructor

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

Implementation

factory FormatConfig.fromJson(Map<String, dynamic> json) {
  return FormatConfig(
    structure: Structure.values.firstWhere(
      (s) => s.name == json['structure'],
      orElse: () => Structure.prose,
    ),
    length: Length.values.firstWhere(
      (l) => l.name == json['length'],
      orElse: () => Length.standard,
    ),
    includeEvidence: json['includeEvidence'] as bool? ?? false,
    includeCaveats: json['includeCaveats'] as bool? ?? false,
    includeAlternatives: json['includeAlternatives'] as bool? ?? false,
    includeNextSteps: json['includeNextSteps'] as bool? ?? false,
    maxParagraphs: json['maxParagraphs'] as int?,
    maxBullets: json['maxBullets'] as int?,
  );
}