maybeOf static method

TabController? maybeOf(
  1. BuildContext context

The closest instance of DefaultTabController that encloses the given context, or null if none is found.

Typical usage is as follows:
TabController? controller = DefaultTabController.maybeOf(context);

Calling this method will create a dependency on the closest DefaultTabController in the context, if there is one.

See also:


static TabController? maybeOf(BuildContext context) {
  return context.dependOnInheritedWidgetOfExactType<_TabControllerScope>()?.controller;