of static method

The closest instance of the SlidableController which controls this Slidable that encloses the given context.

{@tool snippet} Typical usage is as follows:

SlidableController controller = Slidable.of(context);

{@end-tool}

Implementation

static SlidableController? of(BuildContext context) {
  final scope = context
      .getElementForInheritedWidgetOfExactType<_SlidableControllerScope>()
      ?.widget as _SlidableControllerScope?;
  return scope?.controller;
}