build function

TreeNode build(
  1. String path,
  2. String file
)

Xây dựng cây dữ liệu từ file JSON gốc

path - Đường dẫn thư mục chứa file JSON file - Tên file JSON gốc Trả về TreeNode root đã được xử lý hoàn chỉnh

Implementation

TreeNode build(String path, String file) {
  String filePath = '$path/$file';
  String jsonString = File(filePath).readAsStringSync();
  Map<String, dynamic> rootJson = json.decode(jsonString);
  TreeNode root = TreeNode.fromJson(rootJson);
  return parseNodes(path, root);
}