loadMap<T> method Null safety

TreeViewController loadMap<T>(
  1. {List<Map<String, dynamic>> list = const []}
)

Loads this controller with data from a Map. This method expects the user to properly update the state

setState((){
  controller = controller.loadMap(map: dataMap);
});

Implementation

TreeViewController loadMap<T>({List<Map<String, dynamic>> list: const []}) {
  List<Node<T>> treeData =
      list.map((Map<String, dynamic> item) => Node.fromMap<T>(item)).toList();
  return TreeViewController(
    children: treeData,
    selectedKey: this.selectedKey,
  );
}