of static method

_TreeViewScope of(
  1. BuildContext context
)

Calls context.dependOnInheritedWidgetOfExactType<_TreeViewScope>() subscribing context to changes in _TreeViewScope.

Mostly used to get the instances of TreeViewController and TreeViewTheme currently being used by the TreeView.

Implementation

static _TreeViewScope of(BuildContext context) {
  final treeViewScope =
      context.dependOnInheritedWidgetOfExactType<_TreeViewScope>();

  assert(() {
    if (treeViewScope != null) return true;
    throw Exception('No _TreeViewScope was found in the given context.');
  }());

  return treeViewScope!;
}