of method Null safety

TabController? of(
  1. BuildContext context
)

The closest instance of this class that encloses the given context.

Typical usage is as follows:
TabController controller = DefaultTabController.of(context)!;

Implementation

static TabController? of(BuildContext context) {
  final _TabControllerScope? scope = context.dependOnInheritedWidgetOfExactType<_TabControllerScope>();
  return scope?.controller;
}