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:
link
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:

Implementation

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