of<T extends ActiveController> static method

Activator<T> of<T extends ActiveController>(
  1. BuildContext context
)

Gets the instance of the Activator that matches the generic type argument T.

You can access the associated view model via the returned Activator. However you'll most likely want to use the shorthand getActivity function to do so. Gets the current Controller based on the Activator and context.

Activity.getActivity<BaseController>(context).totalTaskLevels();

Implementation

/// Gets the current Controller based on the [Activator] and context.
///```dart
/// Activity.getActivity<BaseController>(context).totalTaskLevels();
///```

static Activator<T> of<T extends ActiveController>(BuildContext context) {
  final Activator<T>? result =
      context.dependOnInheritedWidgetOfExactType<Activator<T>>();
  assert(result != null, 'No Activity found in context');
  return result!;
}