of<T> static method

StateHolder<T> of<T>(
  1. BuildContext context
)

Gets the current state from the BuildContext

Implementation

static StateHolder<T> of<T>(BuildContext context) {
  final result = context.dependOnInheritedWidgetOfExactType<StateHolder<T>>();
  assert(result != null, 'No state of type $T found in context');

  return result!;
}