zenith<T> method

T zenith<T>(
  1. ZenithKey<T> key
)

Resolves the value for key from the nearest ZenithTenantScope's container, or throws if not registered.

Implementation

T zenith<T>(ZenithKey<T> key) {
  final scope = ZenithScopeProvider.of(this);
  final node = scope.container.maybeNode<T>(key);
  if (node == null) {
    throw StateError('No node registered for $key in scope "${scope.id}".');
  }
  return node.value;
}