updateState method

void updateState()

when we've got the data, we need update data without setState() to avoid the flicker of the view

Implementation

void updateState() {
  indexTreeSet.clear();
  markdownGenerator = widget.markdownGenerator ?? MarkdownGenerator();
  final result = markdownGenerator.buildWidgets(
    widget.data,
    onTocList: (tocList) {
      _tocController?.setTocList(tocList);
    },
    config: widget.config,
  );
  _widgets.addAll(result);
}