maybeContainerOf<T extends Object> static method

InternalIocInheritedWidget<T>? maybeContainerOf<T extends Object>(
  1. BuildContext context
)

Retrieves the nearest InternalIocInheritedWidget container of type T, or null if not found.

Implementation

static InternalIocInheritedWidget<T>? maybeContainerOf<T extends Object>(
  BuildContext context,
) {
  return context
          .getElementForInheritedWidgetOfExactType<
            InternalIocInheritedWidget<T>
          >()
          ?.widget
      as InternalIocInheritedWidget<T>?;
}