mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Enhance Info model to handle optional JSON fields gracefully
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.
This commit is contained in:
@@ -11,9 +11,9 @@ class Info {
|
||||
|
||||
factory Info.fromJson(Map<String, dynamic> json) {
|
||||
return Info(
|
||||
difficulty: json['difficulty'],
|
||||
description: json['description'],
|
||||
sideEffects: List<String>.from(json['side_effects']),
|
||||
difficulty: json['difficulty'] ?? "",
|
||||
description: json['description'] ?? "",
|
||||
sideEffects: List<String>.from(json['side_effects'] ?? []),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user