ModelPreferences.fromJson constructor

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

Implementation

factory ModelPreferences.fromJson(Map<String, dynamic> json) {
  final List<dynamic>? hintsList = json['hints'] as List<dynamic>?;
  final hints =
      hintsList
          ?.map((hint) => ModelHint.fromJson(hint as Map<String, dynamic>))
          .toList();

  return ModelPreferences(
    hints: hints,
    costPriority:
        json['costPriority'] != null
            ? (json['costPriority'] as num).toDouble()
            : null,
    speedPriority:
        json['speedPriority'] != null
            ? (json['speedPriority'] as num).toDouble()
            : null,
    intelligencePriority:
        json['intelligencePriority'] != null
            ? (json['intelligencePriority'] as num).toDouble()
            : null,
  );
}