# get<T> abstract method

T get<T>(

1. Class<T> type, {
2. T? orElse,
3. Supplier<T>? orSupply,

})

Returns an instance of the given `type` if it has been registered in the context. The instance will be lazily created on first access.

Throws IllegalStateException if the `type` is not registered.

Example:

    final Logger logger = context.get(Class<Logger>());

    final Logger logger = context.get(
      Class<Logger>(),
      supply: () => Logger('Generated')
    );

    final Logger logger = context.get(
      Class<Logger>(),
      orElse: Logger('Generated')
    );

## Implementation

    T get<T>(Class<T> type, {T? orElse, Supplier<T>? orSupply});