diff --git a/packages/flutter/lib/src/material/tab_controller.dart b/packages/flutter/lib/src/material/tab_controller.dart index da9549c0be..c1f6823015 100644 --- a/packages/flutter/lib/src/material/tab_controller.dart +++ b/packages/flutter/lib/src/material/tab_controller.dart @@ -8,6 +8,9 @@ import 'package:flutter/widgets.dart'; import 'constants.dart'; +// Examples can assume: +// BuildContext context; + /// Coordinates tab selection between a [TabBar] and a [TabBarView]. /// /// The [index] property is the index of the selected tab and the [animation] @@ -336,11 +339,13 @@ class DefaultTabController extends StatefulWidget { /// The closest instance of this class that encloses the given context. /// - /// Typical usage: + /// {@tool sample} + /// Typical usage is as follows: /// /// ```dart - /// TabController controller = DefaultTabBarController.of(context); + /// TabController controller = DefaultTabController.of(context); /// ``` + /// {@end-tool} static TabController of(BuildContext context) { final _TabControllerScope scope = context.dependOnInheritedWidgetOfExactType<_TabControllerScope>(); return scope?.controller;