mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
This commit updates the Info class to provide default values for optional or missing fields in the JSON payload. This ensures that the model can be successfully instantiated even when some JSON fields are absent or set to null.
20 lines
450 B
Dart
20 lines
450 B
Dart
class Info {
|
|
final String difficulty;
|
|
final String description;
|
|
final List<String> sideEffects;
|
|
|
|
Info({
|
|
required this.difficulty,
|
|
required this.description,
|
|
required this.sideEffects,
|
|
});
|
|
|
|
factory Info.fromJson(Map<String, dynamic> json) {
|
|
return Info(
|
|
difficulty: json['difficulty'] ?? "",
|
|
description: json['description'] ?? "",
|
|
sideEffects: List<String>.from(json['side_effects'] ?? []),
|
|
);
|
|
}
|
|
}
|