bindWithType<S> method

S bindWithType<S>(
  1. Type primaryType,
  2. Type secondaryType,
  3. Parameter? parameter
)

Get instance of primary type P and secondary type S (not for scoped instances)

@return instance of type S

Implementation

S bindWithType<S>(
    Type primaryType, Type secondaryType, Parameter? parameter) {
  var definition =
      _instanceRegistry.bind(primaryType, secondaryType, parameter);

  if (definition == null) {
    throw NoBeanDefFoundException("""
    No definition found to bind class:'${primaryType.toString()}' & secondary
    type:'${secondaryType.toString()}'. Check your definitions!""");
  } else {
    return definition;
  }
}