mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
This commit extends the SkillTreeNode class to incorporate new attributes such as 'data', 'label', and 'shape', making the model more comprehensive. The JSON deserialization is also updated to handle optional or missing fields by providing default values, improving the robustness of the model.
28 lines
651 B
Dart
28 lines
651 B
Dart
import 'package:auto_gpt_flutter_client/models/skill_tree/skill_node_data.dart';
|
|
|
|
class SkillTreeNode {
|
|
final String color;
|
|
final SkillNodeData data;
|
|
final String id;
|
|
final String label;
|
|
final String shape;
|
|
|
|
SkillTreeNode({
|
|
required this.color,
|
|
required this.data,
|
|
required this.id,
|
|
required this.label,
|
|
required this.shape,
|
|
});
|
|
|
|
factory SkillTreeNode.fromJson(Map<String, dynamic> json) {
|
|
return SkillTreeNode(
|
|
color: json['color'] ?? "",
|
|
data: SkillNodeData.fromJson(json['data'] ?? {}),
|
|
id: json['id'] ?? "",
|
|
label: json['label'] ?? "",
|
|
shape: json['shape'] ?? "",
|
|
);
|
|
}
|
|
}
|