getBind<T extends Object> method

  1. @override
T? getBind<T extends Object>(
  1. Injector injector
)
inherited

Pega os binds referente a esse contexto.

Implementation

@override
T? getBind<T extends Object>(Injector injector) {
  T bindValue;
  var type = _getInjectType<T>();
  if (_singletonBinds.containsKey(type)) {
    bindValue = _singletonBinds[type]!.value as T;
    return bindValue;
  }

  var bind = _binds.firstWhere(
      (b) => b.factoryFunction is T Function(Injector),
      orElse: () => BindEmpty());
  if (bind is BindEmpty) {
    return null;
  }

  bindValue = bind.factoryFunction(injector) as T;
  if (bind.isSingleton) {
    _singletonBinds[type] = SingletonBind(value: bindValue, bind: bind);
  }

  return bindValue;
}