buildNodes method

Future buildNodes(
  1. dynamic jsonObject, {
  2. bool areAllCollapsed = false,
})

Uses the given jsonObject to build the displayNodes list.

If areAllCollapsed is true, then all nodes will be collapsed, and initially only upper root nodes will be in the list.

notifyListeners is called to notify all registered listeners.

Implementation

Future buildNodes(dynamic jsonObject, {bool areAllCollapsed = false}) async {
  final builtNodes = buildViewModelNodes(jsonObject);
  final flatList = flatten(builtNodes);

  _allNodes = UnmodifiableListView(flatList);
  _displayNodes = List.from(flatList);
  if (areAllCollapsed) {
    collapseAll();
  } else {
    notifyListeners();
  }
}