of static method

TreeNodeScope of(
  1. BuildContext context
)

Finds the nearest TreeNodeScope and subscribes context to state changes.

Implementation

static TreeNodeScope of(BuildContext context) {
  final treeNodeScope =
      context.dependOnInheritedWidgetOfExactType<TreeNodeScope>();

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

  return treeNodeScope!;
}