of<T> static method

T? of<T>(
  1. BuildContext context,
  2. Type type
)

Returns the regionalized resources object of the given type for the widget tree that corresponds to the given context.

Returns null if no resources object of the given type exists within the given context.

Implementation

static T? of<T>(BuildContext context, Type type) {
  final scope =
      context.dependOnInheritedWidgetOfExactType<_RegionalizationsScope>();
  return scope?.state.resourcesFor<T?>(type);
}