loadJSON<T> method Null safety

TreeViewController loadJSON<T>(
  1. {String json = '[]'}
)

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

setState((){
  controller = controller.loadJSON(json: jsonString);
});

Implementation

TreeViewController loadJSON<T>({String json: '[]'}) {
  List jsonList = jsonDecode(json);
  List<Map<String, dynamic>> list = List<Map<String, dynamic>>.from(jsonList);
  return loadMap<T>(list: list);
}