of static method

Wildness of(
  1. BuildContext context, {
  2. bool listen = true,
})

Implementation

static Wildness of(BuildContext context, {bool listen = true}) {
  final WildnessProvider? inheritedTheme = listen
      ? //searches only for InheritedWidget
      context.dependOnInheritedWidgetOfExactType<WildnessProvider>()
      : //does not establish a relationship with the target in the way that dependOnInheritedWidgetOfExactType does.
      (context
          .getElementForInheritedWidgetOfExactType<WildnessProvider>()
          ?.widget as WildnessProvider?);
  //expensive, searches for any Widget subclass
  // context.findAncestorWidgetOfExactType<_InheritedWildnessTheme>();

  //! No podemos retornar una excepcion aqui, para permitir usar los componentes sueltos sin theme
  return inheritedTheme?.data ??
      const Wildness(
        physics: AlwaysScrollableScrollPhysics(),
        components: {},
        fundations: {},
      );
}