of static method

Returns the ScrollController most closely associated with the given context.

Returns null if there is no ScrollController associated with the given context.

Implementation

static ScrollController? of(BuildContext context) {
  final result =
      context.dependOnInheritedWidgetOfExactType<ModalScrollController>();
  return result?.controller;
}